
On Tue, Feb 15, 2011 at 10:58 AM, Germán Diago <germandiago@gmail.com> wrote: [snip]
Ok. The correct way is to reuse libraries as much as possible so that bugs can be corrected always in the same place. But at the same time I would like a syntax that avoids macros as much as possible. For example, my std::tuple inside MyClass uses a macro, but a very obvious one. The rest is understandable. There are many ways to write complicated macros, so I try to avoid them except when there is no other practical way.
I've added two new templates to Mirror that replace the type reflection macros: So now instead of using MIRRORED_TYPE(X), MIRRORED_CLASS(X), ... you can use either the mirror::reflected_type<X> or the mirror::reflected<X> template. Thell be available in the next release or you can get the current version via GIT. mirror::reflected_type<X> *is a* type conforming to the MetaType concept and mirror::reflected<X>::type *returns a* type conforming to the MetaType concept. More precisely these templates provide you with types conforming to either MetaType, MetaClass or MetaEnum, depending on how the type X was registered with Mirror. You can use the categorize_meta_object() function or the meta_object_category<> template to get a tag type for tag dispatching between there concepts. See the following three examples for comparison: http://kifri.fri.uniza.sk/~chochlik/mirror-lib/html/mirror_2example_2typenam... http://kifri.fri.uniza.sk/~chochlik/mirror-lib/html/mirror_2example_2typenam... http://kifri.fri.uniza.sk/~chochlik/mirror-lib/html/mirror_2example_2typenam... I'll add a few more or update the existing examples in the near future. This way you can avoid using macros when reflecting types. I still believe that using macros for the registering is the right thing to do, even with all the problems of preprocessor macros. [snip/] Matus