SizeComputer

Stream-like object that only records how many bytes a serialization would write.

Synopsis

Declared in <serialize.h>

class SizeComputer;

Member Functions

NameDescription
SizeComputer [constructor]Construct a size computer with a zero byte count.
seek Pretend this many bytes are written, without specifying them.
size Return the total number of bytes recorded so far.
write Add the size of a byte span to the running count.
operator<< Add the serialized size of an object to the running count.

Protected Data Members

NameDescription
m_size Running count of bytes that would be written.

Non-Member Functions

NameDescription
WriteCompactSizeAccount for a CompactSize encoding when computing a serialized size.
WriteVarIntAccount for a VarInt encoding when computing a serialized size.