Using

Cause serialization/deserialization of an object to be done using a specified formatter class.

Synopsis

Declared in <serialize.h>

template<
    typename Formatter,
    typename T>
static
Wrapper<Formatter, T&>
Using(T&& t);

Description

To use this, you need a class Formatter that has public functions Ser(stream, const object&) for serialization, and Unser(stream, object&) for deserialization. Serialization routines (inside READWRITE, or directly with << and >> operators), can then use Using<Formatter>(object).

This works by constructing a Wrapper<Formatter, T>-wrapped version of object, where T is const during serialization, and non-const during deserialization, which maintains const correctness.

Return Value

A Wrapper that applies the formatter to t.

Parameters

NameDescription
tThe object to (de)serialize through the formatter.