Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-01-25 17:04:40


"Paul Mensonides" <pmenso57_at_[hidden]> wrote in message

> > cout << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ENUM((x)(y)(z)));

> That shouldn't work regardless. An invocation of SEQ_ENUM with anything
other
> than one element becomes (what I call) an intermediate. An "intermediate"
is an
> argument to a macro that expands to multiple arguments. There is no way
that
> STRINGIZE could be defined to handle an intermediate. E.g.
>
> #define STRINGIZE(x) PRIMITIVE_STRINGIZE(x)
> #define PRIMITIVE_STRINGIZE(x) #x
>
> The delay is necessary to allow 'x' to expand on input to STRINGIZE.
However,
> because it does expand in this case, it tries to invoke:
>
> PRIMITIVE_STRINGIZE(x, y, z)
>
> ...which is, of course, too many arguments.

What about some extra parenthesis:

cout << BOOST_PP_STRINGIZE((BOOST_PP_SEQ_ENUM((x)(y)(z)))); //?

> Did you try the other workaround that I sent?

#undef BOOST_PP_SEQ_ENUM
#define BOOST_PP_SEQ_ENUM(seq) BOOST_PP_SEQ_ENUM_I((seq))
#define BOOST_PP_SEQ_ENUM_I(arg) BOOST_PP_SEQ_ENUM_II ## arg
#define BOOST_PP_SEQ_ENUM_II(seq) \
BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, BOOST_PP_SEQ_SIZE(seq)) seq \
/**/

It doesn't seem to work with stringize (see above). Outputs:

(BOOST_PP_SEQ_ENUM_II((x)(y)(z)))

Without stringize everything seems to work fine in the first place...

I only care about stringize because it seemed to be a convenient way to
debug the stuff...

Regards,

Arkadiy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk