Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2005-02-12 13:36:02


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Arkadiy Vertleyb

Hi Arkadiy.

> I don't think that reentrancy mechanism is working for this
> macro. Is it supposed to?

SEQ_FOR_EACH_I is not a reentrant construct. Basically, only macros with a
"concatenation" variant (e.g. REPEAT_ ## z) are reentrant. All others are
reentrant into those macros. This is a fundamental flaw of the pp-lib design.
In order to allow what you're suggesting, I'd have to make hundreds of copies of
every higher-order macro in the library.

Is there any particular reason why you need 'i' in the outer dimension? If not,
regular SEQ_FOR_EACH and SEQ_FOR_EACH_I should work together:

#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/for_each_i.hpp>

#define A(r, data, elem) \
    BOOST_PP_SEQ_FOR_EACH_I_R(r, B, ~, elem) \
    /**/
#define B(r, data, i, elem) elem

BOOST_PP_SEQ_FOR_EACH(
    A, ~,
    ((1)(2)(3))
    ((4)(5)(6))
    ((7)(8)(9))
)

(Of course, this design limitation doesn't exist in Chaos. All higher-order
macros are reentrant--without implementation replication.)

Regards,
Paul Mensonides


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk