
5) BOOST_TYPE_ERASURE_MEMBER cannot be used in a SEQ_FOR_EACH loop, because it uses SEQ_FOR_EACH internally. It would be handy to have a way to declare several members when the namespace path and prefix (e.g., has_) doesn't change, either by passing the z parameter or using another macro.
Sorry. BOOST_PP_SEQ_FOR_EACH is not re-entrant and I really don't want to try to work around it.
There are two fairly easy ways to work around this. One is to use deferred expressions, like this: #define EMPTY() #define DEFER(x) x EMPTY() #define EXPAND(x) x #define PP_SEQ_FOR_EACH_ID() BOOST_PP_SEQ_FOR_EACH #define FLATTEN_II(r, data, x) x #define FLATTEN_I(r, data, seq) DEFER(PP_SEQ_FOR_EACH_ID)()(FLATTEN_II, ~, seq) #define FLATTEN(seq) EXPAND(BOOST_PP_SEQ_FOR_EACH(FLATTEN_I, ~, seq)) // expands to a b c d e f FLATTEN ( ( (a)(b)(c) ) ( (d)(e)(f) ) ) The second way is to use sequence iteration, like this: #define FLATTEN_II(r, data, x) x #define FLATTEN_I(r, data, seq) BOOST_PP_SEQ_FOR_EACH(FLATTEN_II, ~, seq) #define FLATTEN(seq) BOOST_PP_CAT(FLATTEN_1 seq, _END) #define FLATTEN_1(x) (FLATTEN_I(x)) FLATTEN_2 #define FLATTEN_2(x) (FLATTEN_I(x)) FLATTEN_1 #define FLATTEN_1_END #define FLATTEN_2_END // expands to a b c d e f FLATTEN ( ( (a)(b)(c) ) ( (d)(e)(f) ) ) However, sequence iteration doesn't allow for a data parameter to be passed to it. (Which may not be necessary in some cases) Thanks, Paul Fultz II