[#Serialize-055]
= Serialize
:mrdocs:

`Serialize` overloads

== Synopses

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

Serialize a boolean to a stream as a single byte&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Stream&gt;
void
xref:Serialize-0c6.adoc[Serialize](
    Stream& s,
    bool a);
----

[.small]#xref:Serialize-0c6.adoc[_» more&period;&period;&period;_]#

Serialize a byte to a stream&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Stream&gt;
void
xref:Serialize-07.adoc[Serialize](
    Stream& s,
    std::byte a);
----

[.small]#xref:Serialize-07.adoc[_» more&period;&period;&period;_]#

Serialize a signed 16&hyphen;bit integer to a stream in little&hyphen;endian order&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Stream&gt;
void
xref:Serialize-0f97.adoc[Serialize](
    Stream& s,
    int16&lowbar;t a);
----

[.small]#xref:Serialize-0f97.adoc[_» more&period;&period;&period;_]#

Serialize a signed 32&hyphen;bit integer to a stream in little&hyphen;endian order&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Stream&gt;
void
xref:Serialize-0ff.adoc[Serialize](
    Stream& s,
    int32&lowbar;t a);
----

[.small]#xref:Serialize-0ff.adoc[_» more&period;&period;&period;_]#

Serialize a signed 64&hyphen;bit integer to a stream in little&hyphen;endian order&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Stream&gt;
void
xref:Serialize-0ac.adoc[Serialize](
    Stream& s,
    int64&lowbar;t a);
----

[.small]#xref:Serialize-0ac.adoc[_» more&period;&period;&period;_]#

Serialize a signed 8&hyphen;bit integer to a stream&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Stream&gt;
void
xref:Serialize-0cb.adoc[Serialize](
    Stream& s,
    int8&lowbar;t a);
----

[.small]#xref:Serialize-0cb.adoc[_» more&period;&period;&period;_]#

Serialize an unsigned 16&hyphen;bit integer to a stream in little&hyphen;endian order&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Stream&gt;
void
xref:Serialize-037.adoc[Serialize](
    Stream& s,
    uint16&lowbar;t a);
----

[.small]#xref:Serialize-037.adoc[_» more&period;&period;&period;_]#

Serialize an unsigned 32&hyphen;bit integer to a stream in little&hyphen;endian order&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Stream&gt;
void
xref:Serialize-030.adoc[Serialize](
    Stream& s,
    uint32&lowbar;t a);
----

[.small]#xref:Serialize-030.adoc[_» more&period;&period;&period;_]#

Serialize an unsigned 64&hyphen;bit integer to a stream in little&hyphen;endian order&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Stream&gt;
void
xref:Serialize-0c0.adoc[Serialize](
    Stream& s,
    uint64&lowbar;t a);
----

[.small]#xref:Serialize-0c0.adoc[_» more&period;&period;&period;_]#

Serialize an unsigned 8&hyphen;bit integer to a stream&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Stream&gt;
void
xref:Serialize-065.adoc[Serialize](
    Stream& s,
    uint8&lowbar;t a);
----

[.small]#xref:Serialize-065.adoc[_» more&period;&period;&period;_]#

Serialize any object that provides a Serialize member function&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    typename T&gt;
requires Serializable&lt;T, Stream&gt;
void
xref:Serialize-086.adoc[Serialize](
    Stream& os,
    T const& a);
----

[.small]#xref:Serialize-086.adoc[_» more&period;&period;&period;_]#

Serialize a string as a CompactSize length followed by its bytes&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    typename C&gt;
void
xref:Serialize-024.adoc[Serialize](
    Stream& os,
    std::basic&lowbar;string&lt;C&gt; const& str);
----

[.small]#xref:Serialize-024.adoc[_» more&period;&period;&period;_]#

Serialize a string view as a CompactSize length followed by its bytes&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    typename C&gt;
void
xref:Serialize-00.adoc[Serialize](
    Stream& os,
    std::basic&lowbar;string&lowbar;view&lt;C&gt; const& str);
----

[.small]#xref:Serialize-00.adoc[_» more&period;&period;&period;_]#

Serialize the object pointed to by a shared&lowbar;ptr&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    typename T&gt;
void
xref:Serialize-06b.adoc[Serialize](
    Stream& os,
    std::shared&lowbar;ptr&lt;T const&gt; const& p);
----

[.small]#xref:Serialize-06b.adoc[_» more&period;&period;&period;_]#

Serialize the object pointed to by a unique&lowbar;ptr&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    typename T&gt;
void
xref:Serialize-0a6.adoc[Serialize](
    Stream& os,
    std::unique&lowbar;ptr&lt;T const&gt; const& p);
----

[.small]#xref:Serialize-0a6.adoc[_» more&period;&period;&period;_]#

Deleted overload that forbids serializing char&semi; use uint8&lowbar;t or int8&lowbar;t instead&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    xref:CharNotInt8.adoc[CharNotInt8] V&gt;
void
xref:Serialize-0ef.adoc[Serialize](
    Stream& s,
    V v) = delete;
----

[.small]#xref:Serialize-0ef.adoc[_» more&period;&period;&period;_]#

Serialize a dynamic&hyphen;extent span of basic bytes as raw bytes&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    xref:BasicByte.adoc[BasicByte] B&gt;
void
xref:Serialize-0fd.adoc[Serialize](
    Stream& s,
    std::span&lt;B&gt; span);
----

[.small]#xref:Serialize-0fd.adoc[_» more&period;&period;&period;_]#

Serialize a pair as its first then second element&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    typename K,
    typename T&gt;
void
xref:Serialize-0e8.adoc[Serialize](
    Stream& os,
    std::pair&lt;K, T&gt; const& item);
----

[.small]#xref:Serialize-0e8.adoc[_» more&period;&period;&period;_]#

Serialize a prevector&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    unsigned int N,
    typename T&gt;
void
xref:Serialize-057.adoc[Serialize](
    Stream& os,
    xref:prevector-0c.adoc[prevector&lt;N, T&gt;] const& v);
----

[.small]#xref:Serialize-057.adoc[_» more&period;&period;&period;_]#

Serialize a vector&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    typename T,
    typename A&gt;
void
xref:Serialize-09d.adoc[Serialize](
    Stream& os,
    std::vector&lt;T, A&gt; const& v);
----

[.small]#xref:Serialize-09d.adoc[_» more&period;&period;&period;_]#

Serialize a fixed&hyphen;extent span of basic bytes as raw bytes&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    xref:BasicByte.adoc[BasicByte] B,
    size&lowbar;t N&gt;
void
xref:Serialize-05f.adoc[Serialize](
    Stream& s,
    std::span&lt;B, N&gt; span);
----

[.small]#xref:Serialize-05f.adoc[_» more&period;&period;&period;_]#

Serialize a std&colon;&colon;array of basic bytes as raw bytes&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    xref:BasicByte.adoc[BasicByte] B,
    size&lowbar;t N&gt;
void
xref:Serialize-083.adoc[Serialize](
    Stream& s,
    std::array&lt;B, N&gt; const& a);
----

[.small]#xref:Serialize-083.adoc[_» more&period;&period;&period;_]#

Serialize a C array of basic bytes as raw bytes&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    xref:BasicByte.adoc[BasicByte] B,
    size&lowbar;t N&gt;
void
xref:Serialize-09a.adoc[Serialize](
    Stream& s,
    B const(& a)[]);
----

[.small]#xref:Serialize-09a.adoc[_» more&period;&period;&period;_]#

Serialize a set as a CompactSize count followed by its elements&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    typename K,
    typename Pred,
    typename A&gt;
void
xref:Serialize-0f9d.adoc[Serialize](
    Stream& os,
    std::set&lt;K, Pred, A&gt; const& m);
----

[.small]#xref:Serialize-0f9d.adoc[_» more&period;&period;&period;_]#

Serialize a map as a CompactSize count followed by its entries&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename Stream,
    typename K,
    typename T,
    typename Pred,
    typename A&gt;
void
xref:Serialize-021.adoc[Serialize](
    Stream& os,
    std::map&lt;K, T, Pred, A&gt; const& m);
----

[.small]#xref:Serialize-021.adoc[_» more&period;&period;&period;_]#

== Parameters

[cols="1,4"]
|===
| Name| Description
| *s*
| The output stream&period;
| *a*
| The boolean value to serialize&period;
| *os*
| The output stream&period;
| *str*
| The string to serialize&period;
| *p*
| The shared pointer whose pointee is serialized&period;
| *v*
| The char value that must not be serialized&period;
| *span*
| The span of bytes to serialize&period;
| *item*
| The pair to serialize&period;
| *m*
| The set to serialize&period;
|===


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