Boost logo

Boost :

Subject: Re: [boost] [fusion] [intro] ADAPT_STRUCT extensions
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-07-29 18:35:18

Zitat von Hartmut Kaiser <hartmut.kaiser_at_[hidden]>:

>> 1)
>> ADAPT_STRUCT can adapt public data members only.
>> with the modifications I uploaded here:
>> all data members can be adapted. for example:
>> class A{
>> private:
>> friend class fusion::access;
>> 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; }
>> C, (A)(B),
>> (int,c)
>> )
>> an instance of C is now a fusion sequence of size 3.
>> dapt_derived.hpp
>> private inheritance is supported as above, virtual inheritance is not.
>> I'm not sure if virtual inheritance can be supported.
> Have you seen the new BOOST_FUSION_ADAPT_CLASS() family of utilities which
> allow using (member-) functions instead of direct access to the data members
> of a class/struct?

no I had not, I was using 1.41. where can I see those? can't seem to
find them in 1.43 or the trunk.

do these solve one of the two issues above?
in case you brought it up because then you could have public accessor
functions to private members, I'd still propose to add a way to adapt
private members as shown above.
I'd like to use this for what is apparently known as the "scrap your
boilerplate" pattern in the functional programming world (see the
previous [intro] discussion), which requires adapting each member in
every class used in such an algorithm. there obviously shouldn't be
public accessors for all members.


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