|
Boost Users : |
Subject: Re: [Boost-users] [preprocessor] having trouble using reentrant macros
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-03-29 12:26:51
On Thu, Mar 29, 2012 at 6:39 AM, Rob Desbois <rob.desbois_at_[hidden]> wrote:
> I'm unable to use the reentrant macros for iteration currently..I
> think I'm probably misunderstanding their usage, and a push in the
> right direction would be much appreciated.
>
> My need is to iterate through a sequence, then iterate through a
> sequence nested within each element.
> As I understand, I should be able to call (e.g.):
> * BOOST_PP_SEQ_FOR_EACH(OP, data, seq) to iterate through the outer
> sequence
> * then in OP(r, data, elem) call BOOST_PP_SEQ_FOR_EACH_R(r, OP2, data,
> elem)
>
[...]
Just to add to Paul's reply, no, this isn't going to work, as you've
discovered, due to your attempt to expand SEQ_FOR_EACH_R within an
expansion of SEQ_FOR_EACH_R. I ran into this inconvenience at some point,
too, and simply wrote up a script to define a collection of macros similar
to SEQ_FOR_EACH and SEQ_TRANSFORM that were reentrant (so they used
token-pasting with an pp integral constant). It's fun exercise, but if
you're not into writing it yourself, I'd be happy to point you to the code.
- Jeff
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