mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 02:11:24 +02:00
refactor: Remove redundant file check from AutoFile shift operators
The shift operators will call the write or read member function, which already does the check. Also, call sites are free to directly call ::(Un)Serialize(s, obj) to skip this check, so removing it increases consistency.
This commit is contained in:
@ -560,7 +560,6 @@ public:
|
||||
template <typename T>
|
||||
AutoFile& operator<<(const T& obj)
|
||||
{
|
||||
if (!file) throw std::ios_base::failure("AutoFile::operator<<: file handle is nullptr");
|
||||
::Serialize(*this, obj);
|
||||
return *this;
|
||||
}
|
||||
@ -568,7 +567,6 @@ public:
|
||||
template <typename T>
|
||||
AutoFile& operator>>(T&& obj)
|
||||
{
|
||||
if (!file) throw std::ios_base::failure("AutoFile::operator>>: file handle is nullptr");
|
||||
::Unserialize(*this, obj);
|
||||
return *this;
|
||||
}
|
||||
@ -588,9 +586,6 @@ public:
|
||||
template<typename T>
|
||||
CAutoFile& operator<<(const T& obj)
|
||||
{
|
||||
// Serialize to this stream
|
||||
if (!file)
|
||||
throw std::ios_base::failure("CAutoFile::operator<<: file handle is nullptr");
|
||||
::Serialize(*this, obj);
|
||||
return (*this);
|
||||
}
|
||||
@ -598,9 +593,6 @@ public:
|
||||
template<typename T>
|
||||
CAutoFile& operator>>(T&& obj)
|
||||
{
|
||||
// Unserialize from this stream
|
||||
if (!file)
|
||||
throw std::ios_base::failure("CAutoFile::operator>>: file handle is nullptr");
|
||||
::Unserialize(*this, obj);
|
||||
return (*this);
|
||||
}
|
||||
|
Reference in New Issue
Block a user