Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2006-12-14 16:22:16

On 12/14/2006 06:36 AM, Weapon Liu wrote:
> And by the bye, that it can be used to build a handy pseudo-struct that
> enables full introspection really is a good and fancy feature. However,
> there's something fundamentally irremediable of it, that is, it can't be
> used to build a full-fledged class( rather than a POD-struct), which, I
> think, will too reduce its usefulness w.r.t. this kinda situations.

I think a "full fledged class" (a.k.a. FFC) can be done with mpl::fold
and CRTP. Each method can be in a separate class, and each field may be
in another class. By inheriting each of these separate classes
(actually template classes where 1 template arg is the most derived
class, thus making the pattern an instance of CRTP) with mpl's inherit
linearly, you've inherited both the data members and the methods, and
the CRTP allows any method to call any other method, whether that method
is above or below it in the inheritance heirarchy. I tried this once
with an earlier version of the proto_static_disp.cpp in boost value
under Home/Strings - Text Processing, but I found it wasn't needed; so,
I removed it. I could retrive the earlier version if you want to have a

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