
On Fri, Dec 28, 2012 at 12:38 AM, Andrey Semashev <andrey.semashev@gmail.com
wrote:
Could you elaborate? A short example would certainly help.
struct S { int x; }; namespace framework {namespace serializable { template <> serializable_specification <S> { template <typename Input> static bool read (Input& in, S& out) { return serializable_specification <little_endian <int>>::read(in, out.x)); } template <typename Output> static bool write (S const& in, Output& out) { return serializable_specification <little_endian <int>>::write(in.x, out)); } }; }} Admittedly, the above is not particularly palatable - I wanted to introduce nested serializable_specification calls and avoid referencing operator types above. The library does not constrain the stream type - the above could just as easily assume the presence of stream operators and use those. See: framework/serializable/custom_serialization.cpp for a more complete example and: framework/serializable/custom_serialization_boost.cpp for a syntax closer to that used by boost. Does the library control the validity of the serialized data when
deserializing? Is there an associated overhead?
The library supports custom wrapper types (such as little_endian) and custom implementations (not introduced above - see custom_implementation.cpp or the documentation's tutorial) depending on the type of input validation required.