My “Way Too Generic Serializer”
I wrote a serializer for my engine that is extremely convenient and generic.
A piece of serialization code in the engine looks something like this:
class PlaceMode { public: // ... SERIALIZE_FUNCTION(1) { SERIALIZE_START(); if (version < 1) SERIALIZE_BASE(State); else SERIALIZE_BASE(EditorState); SERIALIZE(archetypeNames); SERIALIZE(lastPosition); SERIALIZE_END(); } private: std::vector<std::string> archetypeNames; Vector4 lastPosition; };