I'm having a problem with multiple nested repeats. I need to generate int x_0_0_0_0 to int x_a_b_c_d. Attempting to do so results in a BOOST_PP_ERROR. For readability, a few shorter defines #define TUPLE_ELEM BOOST_PP_TUPLE_ELEM #define REPEAT BOOST_PP_REPEAT and I also neglect the necessary BOOST_PP_CAT statements in DECL4D in this example #define DECL4D(z, n, text) TUPLE_ELEM(3, text) TUPLE_ELEM(0, text) TUPLE_ELEM(1, text) TUPLE_ELEM(2, text) n; #define DECL4C(z, n, text) REPEAT(TUPLE_ELEM(0, text), DECL4D, (TUPLE_ELEM(1, text), TUPLE_ELEM(2, text), n, TUPLE_ELEM(3, text))) #define DECL4B(z, n, text) REPEAT(TUPLE_ELEM(0, text), DECL4C, (TUPLE_ELEM(1, text), TUPLE_ELEM(2, text), n, TUPLE_ELEM(3, text))) #define DECL4A(z, n, text) REPEAT(TUPLE_ELEM(0, text), DECL4B, (TUPLE_ELEM(1, text), TUPLE_ELEM(2, text), n, TUPLE_ELEM(3, text))) #define decl4(a, b, c, d, text) REPEAT(a, DECL4A, (b, c, d, text)) decl4(1, 1, 1, 1, int x_) Am I hitting a nesting depth limit or something else? Is there a way around this? Ideally I want to write a decl5 macro and have successfully written a decl1, decl2 and decl3 so far Regards, Colin