Boost logo

Boost Users :

Subject: Re: [Boost-users] [Preprocessor] Is it possible to expand recursively?
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-07-17 13:29:08

On 7/17/2011 9:21 AM, TONGARI wrote:
> Hello,
> I'd like to have a macro like:
> (a,
> (b,)
> (c,
> (d,)
> (e,)
> )
> )
> which should expand to:
> struct a {};
> struct b: a {};
> struct c: a {};
> struct d: c {};
> struct e: c {};
> Is this possible at all?
> I have tried but with no luck, if this is impossible, please tell me so.

I think you want above:


This is a tuple with a possible second element as a seq. Each element of
your seq is a tuple with the same rule as the top tuple.

Following internal logic, perhaps with nested BOOST_PP_WHILEs, you
should be able to cycle through each tuple and nested tuple forming the
relationships you have created for your structs above. I can not
guarantee this will be doable but at least you should have some idea of
what to do from the description of what you have.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at