
BOOST_PP_SEQ_FOR_EACH macro when used within another BOOST_PP_SEQ_FOR_EACH does not expand at all (and the same happens with _R versions). I use Visual Studio 2005. A simple test is:
>>>>>>>>>>>>>> #include <boost/preprocessor.hpp>
#define SEQ \ ( ( n1 )( n2 )( n3 ) ) \ ( ( n4 )( n5 )( n6 ) ) #define CAT( _r, _data, _elem ) \ BOOST_PP_CAT( _data, _elem ) #define JOIN( _r, _seq ) \ BOOST_PP_SEQ_FOR_EACH_R( _r, CAT, ::, _seq ) #define MAKE( _r, _data, _elem ) \ JOIN( _r, _elem ) BOOST_PP_SEQ_FOR_EACH( MAKE, nil, SEQ ) <<<<<<<<<<<<<<<<<<<< The expected result is something like:
>>>>>>>>>>>>>> ::n1 ::n2 ::n3 ::n4 ::n5 ::n6 <<<<<<<<<<<<<<<<<<<<
while it is not. Instead we get something like:
>>>>>>>>>>>>>> BOOST_PP_SEQ_FOR_EACH_M(3, (CAT, ::, ( n1 )( n2 )( n3 ) (nil))) BOOST_PP_SEQ_FOR_EACH_M(4, (CAT, ::, ( n2 )( n3 ) (nil))) BOOST_PP_SEQ_FOR_EACH_M(5, (CAT, ::, ( n3 ) (nil))) BOOST_PP_SEQ_FOR_EACH_M(4, (CAT, ::, ( n4 )( n5 )( n6 ) (nil))) BOOST_PP_SEQ_FOR_EACH_M(5, (CAT, ::, ( n5 )( n6 ) (nil))) BOOST_PP_SEQ_FOR_EACH_M(6, (CAT, ::, ( n6 ) (nil))) <<<<<<<<<<<<<<<<<<<<
It seems to me that something is wrong with BOOST_PP_SEQ_FOR_EACH(_R) because following JOIN macro works well in this test case:
>>>>>>>>>>>>>> #define JOIN( _r, _seq ) \ BOOST_PP_LIST_FOR_EACH_R( \ _r, \ CAT, \ ::, \ BOOST_PP_TUPLE_TO_LIST( BOOST_PP_SEQ_SIZE( _seq ), BOOST_PP_SEQ_TO_TUPLE( _seq ) ) \ ) <<<<<<<<<<<<<<<<<<<<
While all it does it to use BOOST_PP_LIST_FOR_EACH_R instead of BOOST_PP_SEQ_FOR_EACH_R and change the given sequence to a tuple and then that tuple to a list. Adam Badura