Boost logo

Boost :

Subject: [boost] [preprocessor] nested for_each not working like expected
From: Eric Niebler (eniebler_at_[hidden])
Date: 2013-08-07 14:49:01


I can't figure out what I'm doing wrong. According to the docs, this
should work:

#define S0 (0)(1)(2)(3)
#define S1 (5)(6)(7)(8)
#define M4(R, DATA, ELEM) (DATA,ELEM)
#define M2(R, DATA, ELEM) BOOST_PP_SEQ_FOR_EACH_R(R, M4, ELEM, S1);
BOOST_PP_SEQ_FOR_EACH(M2, ~, S0)

I expect to get a sequence like (0,1)(0,2)... for each combination. I
get gibberish. (Please don't tell me to use FOR_EACH_PRODUCT. In my real
use case, M2 and M4 are far more complicated, and a simple product won't
do.)

Can anybody please tell me what I'm doing wrong? TIA,

-- 
Eric Niebler
Boost.org

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