Perhaps this can be of use: http://pastebin.com/bQ0j8YMV
It has some stuff specific to the game it is from, and requires some extra engine functions to be able to serialize floats. It does not know the name of the resource it tries to serialize though, so it relies on the order of << and >> calls.
thanks, i will use some parts of this in binary output portion.
i had some goals starting this,
- human readable output
- order of saved variable do not matter
- adding new variable does not corrupt old saves
- removing variables does not corrupt saved files
- no need to modify c++ code
to be used in:
- save/load object to file
- debugger, readable text dump of objects
- transfer state over tcp
but i just cant find a way to learn primitives' name when they are passed as references.
i am stuck with
ser << "int_var";
but i want
ser << int_var;