Subject: Re: [boost] [mirror] -- RFC
From: Matus Chochlik (chochlik_at_[hidden])
Date: 2009-03-30 11:49:44
On Mon, Mar 30, 2009 at 3:59 PM, Mathias Gaunard
> Matus Chochlik wrote:
> From a quick reading of the documentation, I can see this library allows:
> - to register members of a class and to be able to iterate them later at
> compile-time. That kind of thing is already provided by Boost.Fusion
Yes, Boost.Fusion allows this, but I can't imagine any complex
application using just Fusion tuples instead of any regular classes.
Furthermore Mirror can work with existing third-party classes and
with classes that have private members accessible only by get/set member
> - to demangle the result of std::type_info::name
> - to remove the namespace information from the demangled name
> - to do some tests on namespaces which seem quite arcane and not very useful
> to me.
Well, these are just the very basic use-cases of Mirror, I have to
admit that the examples
in the documentation don't cover any more complex cases, yet.
Just to mention some of the more useful features:
- namespace member iteration and traversals, which provide means to
nested namespaces and/or classes in a reflected namespace
or to traverse them recursively by custom visitors.
- class traversals which allow to go through the class' structure (base classes,
member attributes) recursively by a custom visitor and optionally to work just
on the static structure itself or work on actual instances of the
This way generic serialization-like algorithms or algorithms doing
mapping which have a lot of useful meta-data available, can be easily written.
Since Mirror registers and allows to work with the names of class
it can work with data formats using the attribute names (like JSON,
XML, etc.) more
conveniently than Boost.Serialzation does (but obviously Mirror is not seeking
to replace Boost.Serialization ;-)).
(see for example here: http://tinyurl.com/d5ywwb, here
or here http://tinyurl.com/ccoagk)
- intrinsic functions and iterators allow to iterate through class' members and
base-classes or to search for meta-objects satisfying compile-time
- algorithms like 'for_each' allow to execute custom functors on meta-objects
reflecting namespace members, class member attributes, base-classes, etc.
- meta-data provided by class' constructor reflection allow to construct
generic class factories (an example an automatically generated wxWidgets-based
class factory which can construct any type with constructors registerd
can be found here: http://tinyurl.com/crqyxs).
> So I don't see anything really compelling in it. Maybe a few use cases of
> your library would make me more interested?
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk