Template Class ReservedSlot¶
Defined in File serialize.h
Class Documentation¶
-
template<typename T>
class ReservedSlot¶ Handle for a reserved slot in the serializer stream.
When you need to write a value that depends on data written after it (e.g., list size before the list elements in lazy evaluation), use reserve() to create a slot, write the dependent data, then call write() on the slot to fill in the reserved space.
auto size_slot = serializer.reserve<size_t>(); size_t count = 0; for (const auto& item : lazy_list) { serializer.add_value(item); count++; } size_slot.write(count);
- Template Parameters:
T – The type of value reserved (must be a scalar type)