diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2018-03-15 16:48:42 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2018-03-15 16:57:55 -0700 |
commit | 7be9a9a570c1140048f8781ced1111e1d930e517 (patch) | |
tree | e5c1fe3eb3607fb5d8997805990fc633d553c4dd /src/streams.h | |
parent | 2bac3e484114c30548e286972525dd799dbd0a5b (diff) | |
parent | 172f5fa738d419efda99542e2ad2a0f4db5be580 (diff) |
Merge #12683: Fix more constness violations in serialization code
172f5fa738 Support deserializing into temporaries (Pieter Wuille)
2761bca997 Merge READWRITEMANY into READWRITE (Pieter Wuille)
Pull request description:
This is another fragment of improvements from #10785.
The current serialization code does not support serializing/deserializing from/to temporaries (like `s >> CFlatData(script)`). As a result, there are many invocations of the `REF` macro which in addition to changing the reference type also changes the constness. This is unnecessary in C++11 as we can use rvalue references now instead.
The first commit is an extra simplification we can make that removes the duplication of code between `READWRITE` and `READWRITEMANY` (and related functions).
Tree-SHA512: babfa9cb268cc3bc39917e4f0a90e4651c33d85032161e16547a07f3b257b7ca7940e0cbfd69f09439d26fafbb1a6cf6359101043407e2c7aeececf7f20b6eed
Diffstat (limited to 'src/streams.h')
-rw-r--r-- | src/streams.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/streams.h b/src/streams.h index 9f86c4a163..6ba4f103da 100644 --- a/src/streams.h +++ b/src/streams.h @@ -42,7 +42,7 @@ public: } template<typename T> - OverrideStream<Stream>& operator>>(T& obj) + OverrideStream<Stream>& operator>>(T&& obj) { // Unserialize from this stream ::Unserialize(*this, obj); @@ -399,7 +399,7 @@ public: } template<typename T> - CDataStream& operator>>(T& obj) + CDataStream& operator>>(T&& obj) { // Unserialize from this stream ::Unserialize(*this, obj); @@ -543,7 +543,7 @@ public: } template<typename T> - CAutoFile& operator>>(T& obj) + CAutoFile& operator>>(T&& obj) { // Unserialize from this stream if (!file) @@ -686,7 +686,7 @@ public: } template<typename T> - CBufferedFile& operator>>(T& obj) { + CBufferedFile& operator>>(T&& obj) { // Unserialize from this stream ::Unserialize(*this, obj); return (*this); |