
On 04/27/11 13:53, Noah Roberts wrote:
On 4/27/2011 10:42 AM, Matus Chochlik wrote: [snip]
There is also the Mirror reflection library which I plan to submit for review once it is ready.
The project homepage (with links to docs and download page) is located here http://kifri.fri.uniza.sk/~chochlik/mirror-lib/html/
Yeah, the original worked like that. We found the manual registration process ungainly. Also didn't do proper inheritance...which maybe yours does. Had trouble looking at the docs and seeing how to use it since the part that probably does all the work (classes.h) isn't linked in with the examples. Hi, Noah,
Sounds interesting. I'd be interested in seeing the code.
Use of mine is more like so:
struct field0 { typedef int value_type; }; struct field1...2 ...
struct my_reflected_type : build_class < var< field0, rw > , var< field1, r > // can't assign through reflection.
Why not: var< field > , var< field const> instead? I guess I'd have to see the code to really understand why the extra type parameter is needed, but maybe a short explanation would be enough.
>::type { virtual ~my_reflected_type(){} DECLARE_PARAM_CONSTRUCTOR(my_reflected_type);
Could you provide the source code for: DECLARE_PARAM_CONSTRUCTOR to give us some idea of what it's doing?
};
struct my_reflected_type2 : derive_from < my_reflected_type , var< field2, rw > >::type { my_reflected_type2() : type(( field0() <= some_val , field1() <= some_val , field2() <= some_val )) { // directly access read-only value and assign... var<field1,r>::value = 66.; } };
Hmm... does the user have to repeat this some number of times, same the number of fields in the my_reflected_type? IOW, for I=3...N (where N is number of fields in my_reflected_type): my_reflected_typeI { //repeat like my_reflected_type2 }; Or is this done by the macro using boost,preprocessor library? I would guess the latter because providing all this boilerplate code would seem too much to me.
I also have a ref<> so bases can have fields to abstract types.
So far functions haven't been needed here so there's none but I think I have a handle on how that could be done.
All of the above can be treated as a fusion sequence and/or fusion associative sequence (including the param list).
Building records on the fly with field()<=value syntax was very desired. Comes in handy when you have a function expecting a record with x,y,z fields in it, have those values, but don't want to build the record class.
I don't understand that. Could you be more concrete in describing this use case, maybe by providing a concrete example? ---------------------------- BTW, a previous post of your's to the users list: http://thread.gmane.org/gmane.comp.lib.boost.user/66818/focus=67038 seems related to your: field()<=value syntax. Is it? -regards, Larry