Subject: [boost] [fusion] [intro] ADAPT_STRUCT extensions
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-07-29 15:44:20


Hi,

in the discussion about the library I called "Intro" at the time it
has been suggested to use BOOST_FUSION_ADAPT_STRUCT of Boost.Fusion
for data member access.

based on that I'd like to propose two extensions to ADAPT_STRUCT,
which I think are useful beyond my use case:

1)

ADAPT_STRUCT can adapt public data members only.

with the modifications I uploaded here:
http://svn.boost.org/svn/boost/sandbox/intro/boost/fusion/adapted/struct/

all data members can be adapted. for example:

class A{
private:
   friend class fusion::access;
   int a;
};

BOOST_FUSION_ADAPT_STRUCT(A,(int,a) )

2)

adaption of a class including its base class members. for example:

struct A{ int a; };
struct B{ int b; };
struct C : A,B{ int c; }

BOOST_FUSION_ADAPT_STRUCT(A,(int,a) )
BOOST_FUSION_ADAPT_STRUCT(B,(int,b) )
BOOST_FUSION_ADAPT_DERIVED(
   C, (A)(B),
   (int,c)
)

an instance of C is now a fusion sequence of size 3.
http://svn.boost.org/svn/boost/sandbox/intro/boost/fusion/adapted/struct/adapt_derived.hpp

private inheritance is supported as above, virtual inheritance is not.
I'm not sure if virtual inheritance can be supported.