
You should try replacing the ## with BOOST_PP_CAT. The Preprocessor doc indicates that using ## directly can cause the preprocessor to terminate expansion. --- Steve H. -----Original Message----- From: Colin Fowler [mailto:fowler@colinfowler.ie] Sent: Saturday, September 20, 2014 6:36 AM To: Boost-users@lists.boost.org Subject: [Boost-users] BOOT_PP_REPEAT simple nesting problem Hi all, I'm trying to use BOOST_PP to generate some code. I can generate the sequence int x_0 to int x_4 using the code below. #include <boost/preprocessor/repetition/repeat.hpp> #define DECL1(z, n, text) text ## _ ## n = n; #define decl1(text, count) BOOST_PP_REPEAT(count, DECL1, text) decl1 (int x, 5) What I'd like to do is write a decl2 that can be used something like this: decl2 (int x, 5, 2) to generate int x_0_0 to int x_4_1 I've tried nesting BOOST_PP_REPEAT but so far I've been unable to produce the desired behaviour unless I hardcode one of the iteration counts. I'd like to also eventually write a decl3(int x, 5, 3, 4) when I understand how a decl2 would work. Any help much appreciated! Regards, Colin