mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-13 09:54:41 +02:00
Support deserializing into temporaries
Currently, the READWRITE macro cannot be passed any non-const temporaries, as the SerReadWrite function only accepts lvalue references. Deserializing into a temporary is very common, however. See for example things like 's >> VARINT(n)'. The VARINT macro produces a temporary wrapper that holds a reference to n. Fix this by accepting non-const rvalue references instead of lvalue references. We don't propagate the rvalue-ness down, as there are no useful optimizations that only apply to temporaries. Then use this new functionality to get rid of many (but not all) uses of the 'REF' macro (which casts away constness).
This commit is contained in:
@ -348,7 +348,7 @@ public:
|
||||
vout.assign(vAvail.size(), CTxOut());
|
||||
for (unsigned int i = 0; i < vAvail.size(); i++) {
|
||||
if (vAvail[i])
|
||||
::Unserialize(s, REF(CTxOutCompressor(vout[i])));
|
||||
::Unserialize(s, CTxOutCompressor(vout[i]));
|
||||
}
|
||||
// coinbase height
|
||||
::Unserialize(s, VARINT(nHeight));
|
||||
|
Reference in New Issue
Block a user