diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-07-12 08:54:00 +0200 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-07-12 10:00:56 +0200 |
commit | fafe2ca0ce842cd8f0d8135fa8c8bac9b2c72da6 (patch) | |
tree | 480df67ed152d5d50055f9c33c09dc3943eef283 /src/streams.h | |
parent | 9999a49b3299bd25dde4805f5c68adef3876057f (diff) |
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.
Diffstat (limited to 'src/streams.h')
-rw-r--r-- | src/streams.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/src/streams.h b/src/streams.h index 4fbbdc573c..89068bff0d 100644 --- a/src/streams.h +++ b/src/streams.h @@ -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); } |