Boost logo

Boost :

Subject: [boost] Class-level instrospection
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2008-10-09 05:08:42

Daniel Walker a écrit :
> Why don't we both package what we have, upload to vault, and then
> work out merging the two and adding the rest in another thread?

I've cleaned-up my files and 'boostified' them so to speak.
I've uploaded a '' on the vault so you can grab it and
we can start discussing this in a proper topic ;)

Basically i've uploaded the following :


Basically, the usage is really simple.
You want to check if classes provides a bool is_ok(long) method and you
want to catch both const and non-const variations :

BOOST_HAVE_MEMBER_FUNCTION(is_ok, bool(long) )

then the check itself is done via :


For BOOST_HAVE_DATA_MEMBER, my method can only check for public members.
So I added a macoer called BOOST_INSTROSPECTION_SUPPORT(C,V) that have
to be used in user-defined class C that want to publish a member named V
to our introspection mecanism.

struct foo
   private :
   int mValue;

struct bar

   private :
   int mValue;


has_member_data_mValue<foo>::value is false
has_member_data_mValue<bar>::value is true

Other limitations is that currently you can't have various check for a
method with a given name but different signature. I'm working on a fix
using PP sequence and :


In the same way, checking for suff like operator[] yields invalid class
name has_member_function_operator[]. So I propose we hand-code the
following :

BOOST_HAS_SUBSCRIPT_OPERATOR( void(int) ) that builds a
has_subscript_operator<T> class. Other similar operator should be
handled the same way.

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