[#VectorFormatter]
= VectorFormatter
:mrdocs:

Formatter to serialize&sol;deserialize vector elements using another formatter

== Synopsis

Declared in `&lt;serialize&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class Formatter&gt;
struct VectorFormatter;
----

== Description

Example&colon; struct X &lcub; std&colon;&colon;vector&lt;uint64&lowbar;t&gt; v&semi; SERIALIZE&lowbar;METHODS(X, obj) &lcub; READWRITE(Using&lt;VectorFormatter&lt;VarInt&gt;&gt;(obj&period;v))&semi; &rcub; &rcub;&semi; will define a struct that contains a vector of uint64&lowbar;t, which is serialized as a vector of VarInt&hyphen;encoded integers&period;

V is not required to be an std&colon;&colon;vector type&period; It works for any class that exposes a value&lowbar;type, size, reserve, emplace&lowbar;back, back, and const iterators&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:VectorFormatter/Ser.adoc[`Ser`] 
| Serialize a vector&hyphen;like container, writing its size then each element via the formatter&period;
| xref:VectorFormatter/Unser.adoc[`Unser`] 
| Unserialize a vector&hyphen;like container, allocating in bounded batches to limit memory use&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
