
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Arkadiy Vertleyb
BOOST_PP_SEQ_ENUM_3[space](x)(y)(z)
and stops here, probably because of the space.
Please disregard this -- it's definitely not a space problem. There appears to be something wrong with my usage of it -- sometimes it works, and sometimes it doesn't. Something like this doesn't work as I would expect:
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.
But in other contexts it seems to work fine.
Also, if I replace BOOST_PP_SEQ_ENUM with the following:
#define BOOST_PP_SEQ_ENUM(seq) BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, BOOST_PP_SEQ_SIZE(seq)), seq)
The output is "x, y, z" as expected.
Did you try the other workaround that I sent? The problem with the above is that it is picking up expansions that should have happened already (but haven't due to VC's bug-ridden implementation). The problem is that the above creates a dependency between CAT and whatever expansion might be picked up. Regards, Paul Mensonides