|
Boost Users : |
Subject: Re: [Boost-users] [preprocessor] How to transform sequence into sequence of tuples.
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2013-04-12 02:31:07
> 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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net