forked from boostorg/preprocessor
Longer macro parameter names
[SVN r13459]
This commit is contained in:
@ -17,18 +17,18 @@
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/arithmetic/add.hpp>
|
||||
|
||||
/** <p>Repeats the macro <code>M(I,P)</code> for <code>I = [S,E[</code>.</p>
|
||||
/** <p>Repeats the macro <code>MACRO(INDEX,DATA)</code> for <code>INDEX = [FIRST,LAST[</code>.</p>
|
||||
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
M(S,P) M(BOOST_PP_INC(S),P) ... M(BOOST_PP_DEC(E),P)
|
||||
MACRO(FIRST,DATA) MACRO(BOOST_PP_INC(FIRST),DATA) ... MACRO(BOOST_PP_DEC(LAST),DATA)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(I,P) P(I);
|
||||
#define TEST(INDEX,DATA) DATA(INDEX);
|
||||
BOOST_PP_REPEAT_FROM_TO(4,7,TEST,X)
|
||||
</pre>
|
||||
|
||||
@ -48,6 +48,6 @@
|
||||
<li><a href="../../test/repeat_test.cpp">repeat_test.cpp</a></li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_REPEAT_FROM_TO(S,E,M,P) BOOST_PP_REPEAT(BOOST_PP_SUB(E,S),BOOST_PP_REPEAT_FROM_TO_F,(S,M,P))
|
||||
#define BOOST_PP_REPEAT_FROM_TO(FIRST,LAST,MACRO,DATA) BOOST_PP_REPEAT(BOOST_PP_SUB(LAST,FIRST),BOOST_PP_REPEAT_FROM_TO_F,(FIRST,MACRO,DATA))
|
||||
#define BOOST_PP_REPEAT_FROM_TO_F(I,SMP) BOOST_PP_TUPLE_ELEM(3,1,SMP)(BOOST_PP_ADD(I,BOOST_PP_TUPLE_ELEM(3,0,SMP)),BOOST_PP_TUPLE_ELEM(3,2,SMP))
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user