Boost logo

Boost :

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

Zitat von Christopher Schmidt <mr.chr.schmidt_at_[hidden]>:

> I patched the code in the trunk to enable the adaption of private
> attributes. The adaptee just needs to friend "struct
> boost::fusion::extension::access". See changeset 64490
> ( for details.

one small thing, could you change "struct access" to "class access"?
MSVC complains if the key differs between the definition and the
friend declaration, and I think people are more used to "friend class"
(in general, and because of "class serialization::access")

is there a rationale for the "extension" namespace somewhere online?
anything that uses the extension mechanism is in the extension namespace?

> Regarding the second feature request: I am not in favor of adding yet
> another set of BOOST_FUSION_ADAPT_xxx-macros.

> struct A{int x;};
> struct B{int y;};
> struct C : A,B{int z;};

I understand the problem, but I don't think we have a solution yet.
thanks for the idea with segmented sequences, but it looks like a
workaround to me, because what does...:


it says that it adapts the struct C, but it doesn't adapt C, it adapts
the most-derived-level of C.
is there even a use case for this? why would you want to do that?

if there isn't you could say that ADAPT_STRUCT can not be used for
derived classes. you need another macro.
adapting the whole struct C the way you suggested would always require
writing (if I hide all your code behind 1 new macro):


I'd prefer adding new macros to that, e.g. ADAPT_SUBCLASS.

wrt a solution without adding new macros I only see one using C99
variadic macros.
do you know what's the state of those? last I checked the compilers I
use implemented them, and I think they will be part of c++0x because
they are part of C99. but there was also a bug in MSVC's
implementation which I don't know can be worked around.

with variadic macros the adaption of C could look like this:


with no new macros.


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