Boost logo

Boost :

Subject: [boost] Checking interest: reflectable types
From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2011-04-27 12:41:53

In my work I've developed a sort of reflection library for C++. There
are still many problems to solve before it could near real reflection
but I don't believe they are insoluble. It works much like fusion maps
except that you can extend them through inheritance. In fact, my
current implementation uses fusion to do its thing and with some minor
changes to fusion::map it could provide the base.

There is a boost.reflection proposal out there that is meant to work
with boost.extension. This one is a bit different in that you're not
additionally defining data; instead you declare your reflection as you
declare your reflectable type through the instantiation of and
inheritance from template metafunctions.

It's primarily a static/compile-time kind of reflection but can be
extended into runtime simply by making your field types a little
smarter. Fields describe the data and provide access identifiers.
Since they are general types that simply have to have an internal
typedef you can attach whatever information is useful. We've done such
things as attach valid value ranges, labels, etc...

I currently use it do auto-construct property trees for user editing. I
plan to use it for scripting/extension. I've had a look at boost.python
and it looks like it would be possible, without too much difficulty, to
automate python exposure of these types. A coworker with 0 experience
in metaprogramming found it fairly easy to feed the types into a
structure meant for a report design and printing library.

This isn't a promise to actually do anything. I'm just gauging how
much, if any interest there is to decide if I want to go to the trouble
of hobby developing a publicly available and usable version.

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