Subject: Re: [boost] [preprocessor] nested for_each not working like expected
From: paul Fultz (pfultz2_at_[hidden])
Date: 2013-08-07 16:14:32


>
> Yes, but [2] indicates that SEQ_FOR_EACH is implemented in terms of FOR
> and has a _R version for reentry. Why is it provided if it doesn't work?

The `R` is the recursion state for the `BOOST_PP_FOR` macro. Because it is
reentrant, you don't pass the state in as a parameter, but instead append it
to the the end of the macro(ie `BOOST_PP_FOR_1`, `BOOST_PP_FOR_2`,
`BOOST_PP_FOR_3`, etc). `BOOST_PP_SEQ_FOR_EACH_R` uses `BOOST_PP_FOR`
internally and provides a parameter for this state so it can reenter
`BOOST_PP_FOR` effeciently(otherwise it would need to deduce the state of
`BOOST_PP_FOR`). If `BOOST_PP_SEQ_FOR_EACH` was reentrant as well, there would
be an additional recursion state that would needed to be appended to the end.

Paul Fultz II