Implement the Serialize and Unserialize methods by delegating to a single templated static method that takes the to‐be‐(de)serialized object as a parameter. This approach has the advantage that the constness of the object becomes a template parameter, and thus allows a single implementation that sees the object as const for serializing and non‐const for deserializing, without casts.

Synopsis

Declared in <serialize.h>

#define SERIALIZE_METHODS(cls, obj)

Parameters

Name

Description

cls

The class whose objects gain Serialize and Unserialize methods.

obj

The name bound to the object inside the generated method body.

Created with MrDocs