forked from boostorg/preprocessor
Docs updated
[SVN r13169]
This commit is contained in:
@ -27,6 +27,21 @@
|
||||
|
||||
<p>The length of the sequence is determined by <code>C(R,X)</code>.</p>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define C(R,X) BOOST_PP_LESS(BOOST_PP_TUPLE_ELEM(2,0,X),BOOST_PP_TUPLE_ELEM(2,1,X))
|
||||
#define F(R,X) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,X)),BOOST_PP_TUPLE_ELEM(2,1,X))
|
||||
#define I(R,X) BOOST_PP_TUPLE_ELEM(2,0,X)
|
||||
BOOST_PP_FOR((0,3),C,F,I)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
0 1 2
|
||||
</pre>
|
||||
|
||||
<h3>Legend</h3>
|
||||
<ul>
|
||||
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
||||
@ -44,21 +59,6 @@
|
||||
by the C++ preprocessor.</li>
|
||||
</ul>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define C(R,X) BOOST_PP_LESS(BOOST_PP_TUPLE_ELEM(2,0,X),BOOST_PP_TUPLE_ELEM(2,1,X))
|
||||
#define F(R,X) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,X)),BOOST_PP_TUPLE_ELEM(2,1,X))
|
||||
#define I(R,X) BOOST_PP_TUPLE_ELEM(2,0,X)
|
||||
BOOST_PP_FOR((0,3),C,F,I)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
0 1 2
|
||||
</pre>
|
||||
|
||||
<h3>BOOST_PP_REPEAT() vs BOOST_PP_FOR()</h3>
|
||||
|
||||
<p>BOOST_PP_FOR() is a generalization of BOOST_PP_REPEAT(). This means that
|
||||
|
@ -33,7 +33,7 @@ list <code>L</code> (from the left or the start of the list).</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(D,P,X) BOOST_PP_CAT(P,X)
|
||||
BOOST_PP_FOLD_LEFT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
BOOST_PP_LIST_FOLD_LEFT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
@ -36,6 +36,19 @@ list <code>L</code> (from the right or the end of the list).</p>
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(D,X,P) BOOST_PP_CAT(P,X)
|
||||
BOOST_PP_LIST_FOLD_RIGHT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
_CBA
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE() (see for explanation of the D parameter)</li>
|
||||
|
@ -27,6 +27,19 @@ BOOST_PP_LIST_SIZE(L)[.</p>
|
||||
F(R,P,BOOST_PP_LIST_AT(L,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(L))))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(R,P,X) BOOST_PP_CAT(P,X)();
|
||||
BOOST_PP_LIST_FOR_EACH(TEST,prefix_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
prefix_A(); prefix_B(); prefix_C();
|
||||
</pre>
|
||||
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/catch_builtin.cpp">catch_builtin.cpp</a></li>
|
||||
|
@ -29,6 +29,19 @@ BOOST_PP_LIST_SIZE(L)[.</p>
|
||||
F(R,P,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(L)),BOOST_PP_LIST_AT(L,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(L))))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(R,P,I,X) BOOST_PP_CAT(P,X)(I);
|
||||
BOOST_PP_LIST_FOR_EACH_I(TEST,prefix_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
prefix_A(0); prefix_B(1); prefix_C(2);
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_FOR() (see for explanation of the R parameter)</li>
|
||||
|
@ -25,6 +25,25 @@ cartesian product of the lists of the <code>N</code>-tuple <code>T_OF_L</code>.<
|
||||
<p>This macro is useful for generating code to avoid combinatorial
|
||||
explosion.</p>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(R,X) X
|
||||
BOOST_PP_LIST_FOR_EACH_PRODUCT
|
||||
( TEST
|
||||
, 2
|
||||
, ( BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))
|
||||
, BOOST_PP_TUPLE_TO_LIST(2,(1,2))
|
||||
)
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
(A,1) (A,2) (B,1) (B,2) (C,1) (C,2)
|
||||
</pre>
|
||||
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/is_integral.cpp">is_integral.cpp</a></li>
|
||||
|
@ -26,6 +26,20 @@
|
||||
|
||||
<p>The depth of iteration is determined by <code>C(D,X)</code>.</p>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define C(D,X) BOOST_PP_LESS_D(D,BOOST_PP_TUPLE_ELEM(2,0,X),BOOST_PP_TUPLE_ELEM(2,1,X))
|
||||
#define F(D,X) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,X)),BOOST_PP_TUPLE_ELEM(2,1,X))
|
||||
BOOST_PP_WHILE(C,F,(0,3))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
(3,3)
|
||||
</pre>
|
||||
|
||||
<h3>Legend</h3>
|
||||
<ul>
|
||||
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
||||
|
Reference in New Issue
Block a user