
remi.chateauneu@gmx.de schrieb:
To summarize, given a struct or class, you just needed one or several list of fields, to be able to serialize these fields only, in a specific order.
There were operators for serializing to a screen, creating 'CREATE TABLE', 'INSERT' and 'SELECT' sql queries, writing to a network socket, filling Windows dialogs, etc...
I had a quick look at a code example of your library and like to add that it is possible to do this without having to declare a list of members outside the class: struct Class{ FIELD(int,a); }; #define FIELD(ValueT,name) struct _##name##_Function{ inline void Register(){ _RegisterField<This,ValueT,_##name##_Function>()(&This::name,#name); } } _ClassField<ValueT,_##name##_Function> name; _ClassField is a class which behaves like a ValueT, with one difference: template<typename ValueT,typename Function> _ClassField<ValueT,Function>::_ClassField(){ //generates _no_ code, empty inline function. is there to instantiated _StaticRegisterer<Function> _StaticRegisterer<Function>::field.Reference() } template<typename T> struct _StaticRegisterer{ static _FieldRegisterer<T> field; }; template<typename T> struct _FieldRegisterer{ _FieldRegisterer(); //this gets called at program startup, _not_ at field construction, and registers the field. inline void Reference(){} }; -- Stefan Strasser