<tr><tdnowrapalign=rightvalign=top>#define </td><tdvalign=bottom><aclass="el"href="repeat_8hpp.html#a1">BOOST_PREPROCESSOR_REPEAT</a>(N, M, P)</td></tr>
<tr><td> </td><td><fontsize=-1><em>Obsolete. Use <aclass="el"href="repeat_8hpp.html#a0">BOOST_PP_REPEAT</a>().</em><ahref="#a1">More...</a><em></em></font><br><br></td></tr>
2D and 3D repetition are supported with the <aclass="el"href="repeat__2nd_8hpp.html#a0">BOOST_PP_REPEAT_2ND</a>() and <aclass="el"href="repeat__3rd_8hpp.html#a0">BOOST_PP_REPEAT_3RD</a>() macros. For example,
<p>
<pre><divclass="fragment"><pre>
// A generalized macro for generating 2D arrays
#define ARRAY_2D(W,H,M,P)\
BOOST_PP_REPEAT_2ND\
( H\
, ARRAY_2D_ROW\
, (W,H,M,P)\
)
#define ARRAY_2D_ROW(Y,WHMP)\
BOOST_PP_EXPAND\
( BOOST_PP_REPEAT\
( BOOST_PP_TUPLE_ELEM(4,0,WHMP)\
, ARRAY_2D_ELEM\
, (Y,BOOST_PP_TUPLE4_ENUM WHMP)\
)\
)
#define BOOST_PP_TUPLE4_ENUM(A,B,C,D) A,B,C,D
#define ARRAY_2D_ELEM(X,YWHMP)\
BOOST_PP_TUPLE_ELEM(5,3,YWHMP)\
BOOST_PP_EXPAND\
( ( X\
, BOOST_PP_TUPLE_ELEM(5,0,YWHMP)\
, BOOST_PP_TUPLE_ELEM(5,1,YWHMP)\
, BOOST_PP_TUPLE_ELEM(5,2,YWHMP)\
, BOOST_PP_TUPLE_ELEM(5,4,YWHMP)\
)\
)
// Here we use the above macro to generate something
Since recursive expansion of macros is not allowed by the C++ preprocessor, replacing the BOOST_PP_REPEAT_2ND above with BOOST_PP_REPEAT, would not produce the above expansion.
<p>
See <aclass="el"href="for_8hpp.html#a0">BOOST_PP_FOR</a>(). </td>