[mpl, preprocessor] Using BOOST_MPL_ASSERT in BOOST_PP_REPEAT

Consider: #define BOOST_PP_RDB_MPL_ASSERT(z, n, t) \ BOOST_MPL_ASSERT((BOOST_PP_TUPLE_ELEM( \ 2, 0, t)<BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, t), n)>)); // in a file passed to BOOST_PP_ITERATE() BOOST_PP_REPEAT(n, BOOST_PP_RDB_MPL_ASSERT, (is_column_container, Col)) This works with msvc9 express but not with g++ 4.4.1. When I dig it I see that BOOST_MPL_ASSERT creates an identifier based on BOOST_MPL_AUX_PP_COUNTER() which in turns uses either __COUNTER__ (with msvc9) or __LINE__ (with g++). So with g++ we get name clashes when `n` is greater than one, because the ASSERT macro attempts to create several variables with the same name in the same scope. I guess I could copy the code of BOOST_MPL_ASSERT() in my BOOST_PP_RDB_MPL_ASSERT macro and incorporate `n` in the identifier. Is there a better solution ? Thanks, J-L
participants (1)
-
Jean-Louis Leroy