
12 Apr
2013
12 Apr
'13
6:31 a.m.
Ah, thanks. I was going down the BOOST_PP_SEQ_FOR_EACH path. My algorithm was going to be
#define SEQ (a)(b)(c)(d) #define WRAP(r, data, elem) \ LPAREN_IF(MOD(elem-index,2)) elem COMMA_IF(MOD(elem-index,2)) RPAREN_IF(NOT(MOD(elem-index,2))) SEQ_FOR_EACH(WRAP, ~, SEQ)
But I couldn't figure out how to get the element index.
If you use SEQ_FOR_EACH_I, the element index will be passed in as an extra argument to WRAP.
BTW, what is the "next available BOOST_PP_FOR repetition" in the ternary macro for SEQ_FOR_EACH?
This is explained in Topics -> Reentrancy in the Boost.PP docs. Regards, Nate