#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/seq/for_each_i.hpp> #define SEQ (a)(b)(c)(d) #define MACRO(r, data, i, elem) BOOST_PP_CAT(elem, BOOST_PP_CAT(data, i)) BOOST_PP_SEQ_FOR_EACH_I(MACRO, _, SEQ) // expands to a_0 b_1 c_2 d_3
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)