mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-12 20:16:36 +02:00
Docs updated
[SVN r13169]
This commit is contained in:
@ -38,6 +38,21 @@
|
|||||||
|
|
||||||
<p>The length of the sequence is determined by <code>C(R,X)</code>.</p>
|
<p>The length of the sequence is determined by <code>C(R,X)</code>.</p>
|
||||||
|
|
||||||
|
<p>For example,</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
#define C(R,X) <a href="comparison_less.htm#BOOST_PP_LESS">BOOST_PP_LESS</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,X),<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,X))
|
||||||
|
#define F(R,X) (<a href="inc.htm#BOOST_PP_INC">BOOST_PP_INC</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,X)),<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,X))
|
||||||
|
#define I(R,X) <a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,X)
|
||||||
|
<a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>((0,3),C,F,I)
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>expands to:</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
0 1 2
|
||||||
|
</pre>
|
||||||
|
|
||||||
<h3>Legend</h3>
|
<h3>Legend</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
||||||
@ -55,21 +70,6 @@
|
|||||||
by the C++ preprocessor.</li>
|
by the C++ preprocessor.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>For example,</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
#define C(R,X) <a href="comparison_less.htm#BOOST_PP_LESS">BOOST_PP_LESS</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,X),<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,X))
|
|
||||||
#define F(R,X) (<a href="inc.htm#BOOST_PP_INC">BOOST_PP_INC</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,X)),<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,X))
|
|
||||||
#define I(R,X) <a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,X)
|
|
||||||
<a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>((0,3),C,F,I)
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<p>expands to:</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
0 1 2
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h3><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>() vs <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>()</h3>
|
<h3><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>() vs <a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>()</h3>
|
||||||
|
|
||||||
<p><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() is a generalization of <a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>(). This means that
|
<p><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() is a generalization of <a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>(). This means that
|
||||||
|
@ -40,6 +40,19 @@ list <code>L</code> (from the left or the start of the list).</p>
|
|||||||
)
|
)
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<p>For example,</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
#define TEST(D,P,X) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,X)
|
||||||
|
<a href="list_fold_left.htm#BOOST_PP_LIST_FOLD_LEFT">BOOST_PP_LIST_FOLD_LEFT</a>(TEST,_,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>expands to:</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
_ABC
|
||||||
|
</pre>
|
||||||
|
|
||||||
<h3>Note</h3>
|
<h3>Note</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Folding, or accumulation, is a very general pattern of computation.
|
<li>Folding, or accumulation, is a very general pattern of computation.
|
||||||
|
@ -48,6 +48,19 @@ list <code>L</code> (from the right or the end of the list).</p>
|
|||||||
)
|
)
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<p>For example,</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
#define TEST(D,X,P) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,X)
|
||||||
|
<a href="list_fold_right.htm#BOOST_PP_LIST_FOLD_RIGHT">BOOST_PP_LIST_FOLD_RIGHT</a>(TEST,_,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>expands to:</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
_CBA
|
||||||
|
</pre>
|
||||||
|
|
||||||
<h3>Uses</h3>
|
<h3>Uses</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for explanation of the D parameter)</li>
|
<li><a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>() (see for explanation of the D parameter)</li>
|
||||||
|
@ -39,6 +39,19 @@
|
|||||||
F(R,P,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(L,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(L))))
|
F(R,P,<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(L,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(L))))
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<p>For example,</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
#define TEST(R,P,X) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,X)();
|
||||||
|
<a href="list_for_each.htm#BOOST_PP_LIST_FOR_EACH">BOOST_PP_LIST_FOR_EACH</a>(TEST,prefix_,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>expands to:</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
prefix_A(); prefix_B(); prefix_C();
|
||||||
|
</pre>
|
||||||
|
|
||||||
<h3>Example</h3>
|
<h3>Example</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="../../example/catch_builtin.cpp">catch_builtin.cpp</a></li>
|
<li><a href="../../example/catch_builtin.cpp">catch_builtin.cpp</a></li>
|
||||||
|
@ -39,6 +39,19 @@
|
|||||||
F(R,P,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(L)),<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(L,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(L))))
|
F(R,P,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(L)),<a href="list_at.htm#BOOST_PP_LIST_AT">BOOST_PP_LIST_AT</a>(L,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(<a href="list_size.htm#BOOST_PP_LIST_SIZE">BOOST_PP_LIST_SIZE</a>(L))))
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<p>For example,</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
#define TEST(R,P,I,X) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,X)(I);
|
||||||
|
<a href="list_for_each_i.htm#BOOST_PP_LIST_FOR_EACH_I">BOOST_PP_LIST_FOR_EACH_I</a>(TEST,prefix_,<a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C)))
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>expands to:</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
prefix_A(0); prefix_B(1); prefix_C(2);
|
||||||
|
</pre>
|
||||||
|
|
||||||
<h3>Uses</h3>
|
<h3>Uses</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() (see for explanation of the R parameter)</li>
|
<li><a href="for.htm#BOOST_PP_FOR">BOOST_PP_FOR</a>() (see for explanation of the R parameter)</li>
|
||||||
|
@ -33,6 +33,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
|
<p>This macro is useful for generating code to avoid combinatorial
|
||||||
explosion.</p>
|
explosion.</p>
|
||||||
|
|
||||||
|
<p>For example,</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
#define TEST(R,X) X
|
||||||
|
<a href="list_for_each_product.htm#BOOST_PP_LIST_FOR_EACH_PRODUCT">BOOST_PP_LIST_FOR_EACH_PRODUCT</a>
|
||||||
|
( TEST
|
||||||
|
, 2
|
||||||
|
, ( <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(3,(A,B,C))
|
||||||
|
, <a href="tuple_to_list.htm#BOOST_PP_TUPLE_TO_LIST">BOOST_PP_TUPLE_TO_LIST</a>(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>
|
<h3>Example</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="../../example/is_integral.cpp">is_integral.cpp</a></li>
|
<li><a href="../../example/is_integral.cpp">is_integral.cpp</a></li>
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
<h2><a name="BOOST_PP_BOOL">#define BOOST_PP_BOOL</a>(X)</h2>
|
<h2><a name="BOOST_PP_BOOL">#define BOOST_PP_BOOL</a>(X)</h2>
|
||||||
<p>Expands to <code>0</code> if <code>X == 0</code> and <code>1</code> if <code>X != 0</code>.</p>
|
<p>Expands to <code>0</code> if <code>X == 0</code> and <code>1</code> if <code>X != 0</code>.</p>
|
||||||
|
|
||||||
|
<p>For example, <code><a href="logical_bool.htm#BOOST_PP_BOOL">BOOST_PP_BOOL</a>(3)</code> expands to <code>1</code>.</p>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<h2><a name="BOOST_PREPROCESSOR_BOOL">#define BOOST_PREPROCESSOR_BOOL</a>(X)</h2>
|
<h2><a name="BOOST_PREPROCESSOR_BOOL">#define BOOST_PREPROCESSOR_BOOL</a>(X)</h2>
|
||||||
|
@ -35,6 +35,19 @@
|
|||||||
M(0,P) M(1,P) ... M(<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(N),P)
|
M(0,P) M(1,P) ... M(<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(N),P)
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<p>For example,</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
#define TEST(I,P) P(I);
|
||||||
|
<a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>(3,TEST,X)
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>expands to:</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
X(0); X(1); X(2);
|
||||||
|
</pre>
|
||||||
|
|
||||||
<h3>2D and 3D repetition</h3>
|
<h3>2D and 3D repetition</h3>
|
||||||
|
|
||||||
<p>2D and 3D repetition are supported with the <a href="repeat_2nd.htm#BOOST_PP_REPEAT_2ND">BOOST_PP_REPEAT_2ND</a>() and
|
<p>2D and 3D repetition are supported with the <a href="repeat_2nd.htm#BOOST_PP_REPEAT_2ND">BOOST_PP_REPEAT_2ND</a>() and
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
<h2><a name="BOOST_PP_STRINGIZE">#define BOOST_PP_STRINGIZE</a>(X)</h2>
|
<h2><a name="BOOST_PP_STRINGIZE">#define BOOST_PP_STRINGIZE</a>(X)</h2>
|
||||||
<p>Stringizes <code>X</code> after it is macro expanded.</p>
|
<p>Stringizes <code>X</code> after it is macro expanded.</p>
|
||||||
|
|
||||||
|
<p>For example, <code><a href="stringize.htm#BOOST_PP_STRINGIZE">BOOST_PP_STRINGIZE</a>(<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(a,b))</code> expands to <code>"ab"</code>.</p>
|
||||||
|
|
||||||
<h3>Example</h3>
|
<h3>Example</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="../../example/note.c">note.c</a></li>
|
<li><a href="../../example/note.c">note.c</a></li>
|
||||||
|
@ -37,6 +37,20 @@
|
|||||||
|
|
||||||
<p>The depth of iteration is determined by <code>C(D,X)</code>.</p>
|
<p>The depth of iteration is determined by <code>C(D,X)</code>.</p>
|
||||||
|
|
||||||
|
<p>For example,</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
#define C(D,X) <a href="comparison_less.htm#BOOST_PP_LESS_D">BOOST_PP_LESS_D</a>(D,<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,X),<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,X))
|
||||||
|
#define F(D,X) (<a href="inc.htm#BOOST_PP_INC">BOOST_PP_INC</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,X)),<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,X))
|
||||||
|
<a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>(C,F,(0,3))
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>expands to:</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
(3,3)
|
||||||
|
</pre>
|
||||||
|
|
||||||
<h3>Legend</h3>
|
<h3>Legend</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
||||||
|
@ -27,6 +27,21 @@
|
|||||||
|
|
||||||
<p>The length of the sequence is determined by <code>C(R,X)</code>.</p>
|
<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>
|
<h3>Legend</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
<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>
|
by the C++ preprocessor.</li>
|
||||||
</ul>
|
</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>
|
<h3>BOOST_PP_REPEAT() vs BOOST_PP_FOR()</h3>
|
||||||
|
|
||||||
<p>BOOST_PP_FOR() is a generalization of BOOST_PP_REPEAT(). This means that
|
<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>
|
<pre>
|
||||||
#define TEST(D,P,X) BOOST_PP_CAT(P,X)
|
#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>
|
</pre>
|
||||||
|
|
||||||
<p>expands to:</p>
|
<p>expands to:</p>
|
||||||
|
@ -36,6 +36,19 @@ list <code>L</code> (from the right or the end of the list).</p>
|
|||||||
)
|
)
|
||||||
</pre>
|
</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>
|
<h3>Uses</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>BOOST_PP_WHILE() (see for explanation of the D parameter)</li>
|
<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))))
|
F(R,P,BOOST_PP_LIST_AT(L,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(L))))
|
||||||
</pre>
|
</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>
|
<h3>Example</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="../../example/catch_builtin.cpp">catch_builtin.cpp</a></li>
|
<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))))
|
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>
|
</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>
|
<h3>Uses</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>BOOST_PP_FOR() (see for explanation of the R parameter)</li>
|
<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
|
<p>This macro is useful for generating code to avoid combinatorial
|
||||||
explosion.</p>
|
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>
|
<h3>Example</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="../../example/is_integral.cpp">is_integral.cpp</a></li>
|
<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>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>
|
<h3>Legend</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
<li><b>X</b> is the current state of iteration. The state is usually a tuple.</li>
|
||||||
|
Reference in New Issue
Block a user