Boost logo

Boost :

Subject: Re: [boost] [intro] Preview: Introspection library
From: Matus Chochlik (chochlik_at_[hidden])
Date: 2010-06-28 10:01:12

On Mon, Jun 28, 2010 at 3:32 PM, Sohail Somani <sohail_at_[hidden]> wrote:
> On 10-06-28 8:00 AM, Stefan Strasser wrote:
>> template<class Mapping>
>> friend void introspect(Mapping mapping,type<A>){
>>   mapping
>>     (base_class<A_base>()                  )
>>     (member<A,int             ,&A::m_a>()  )
>>     (member<A,float           ,&A::m_b>()  )
>>     (member<A,std::vector<int>,&A::m_vec>())
>>   ();
>> }
> I think a library like this would be useful.

Just FYI there is also another introspection/reflection library being developed
for boost called Mirror. It can be downloaded from sourceforge here:
or from the boost vault.

There are actually two versions: pre-c++0x (which is currently on hold)
and c++0x (being actively developed)

The current (work-in-progress) docs for the c++0x version can be found here:

To get some idea on how the library is used I suggest looking here:

The registering process is explained here:
although much more can be found in the docs.

> Isn't it simpler to specialize a template? Why does this need to be done at
> run-time? How do you introspect a type's constructors?

Mirror allows to introspect constructors and actually there is a utility called
factory generator, which uses this meta-information to generate factory
classes for various product types.The docs for this utility can be found here:
but they are not finished.



BR, Matus

Boost list run by bdawes at, gregod at, cpdaniel at, john at