VectorFormatter

Formatter to serialize/deserialize vector elements using another formatter

Synopsis

Declared in <serialize.h>

template<class Formatter>
struct VectorFormatter;

Description

Example: struct X { std::vector<uint64_t> v; SERIALIZE_METHODS(X, obj) { READWRITE(Using<VectorFormatter<VarInt>>(obj.v)); } }; will define a struct that contains a vector of uint64_t, which is serialized as a vector of VarInt-encoded integers.

V is not required to be an std::vector type. It works for any class that exposes a value_type, size, reserve, emplace_back, back, and const iterators.

Member Functions

NameDescription
Ser Serialize a vector-like container, writing its size then each element via the formatter.
Unser Unserialize a vector-like container, allocating in bounded batches to limit memory use.