mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-12 12:06:34 +02:00
Docs update
[SVN r13144]
This commit is contained in:
@ -29,6 +29,9 @@
|
||||
<h2><a name="BOOST_PP_ASSERT_MSG">#define BOOST_PP_ASSERT_MSG</a>(C,MSG)</h2>
|
||||
<p>Expands to nothing if <code>C != 0</code> and to <code>MSG</code> if
|
||||
<code>C == 0</code>.</p>
|
||||
|
||||
<p>For example, <code><a href="assert_msg.htm#BOOST_PP_ASSERT_MSG">BOOST_PP_ASSERT_MSG</a>(1,A BUG!)</code> expands to <code>A BUG!</code>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2><a name="BOOST_PREPROCESSOR_ASSERT_MSG">#define BOOST_PREPROCESSOR_ASSERT_MSG</a>(C,MSG)</h2>
|
||||
|
@ -30,6 +30,8 @@
|
||||
<p>Concatenates <code>X</code> and <code>Y</code> after they are macro
|
||||
expanded.</p>
|
||||
|
||||
<p>For example, <code><a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(A,<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(_,B))</code> expands to <code>A_B</code>.</p>
|
||||
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/static_assert.c">static_assert.c</a></li>
|
||||
|
@ -27,7 +27,18 @@
|
||||
<hr>
|
||||
|
||||
<h2><a name="BOOST_PP_COMMA">#define BOOST_PP_COMMA</a>()</h2>
|
||||
<p>Expands to a comma. Can be used with <a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>().</p>
|
||||
<p>Expands to a comma.</p>
|
||||
|
||||
<p>Commas need special handling in preprocessor code, because commas are used
|
||||
for separating macro parameters.</p>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
<a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>(1,<a href="comma.htm#BOOST_PP_COMMA">BOOST_PP_COMMA</a>,<a href="empty.htm#BOOST_PP_EMPTY">BOOST_PP_EMPTY</a>)()
|
||||
</pre>
|
||||
|
||||
<p>expands to a comma.</p>
|
||||
|
||||
<h3>See</h3>
|
||||
<ul>
|
||||
|
@ -30,6 +30,8 @@
|
||||
<p>Expands to a comma if <code>C != 0</code> and nothing if
|
||||
<code>C == 0</code>.</p>
|
||||
|
||||
<p>For example, <code><a href="comma_if.htm#BOOST_PP_COMMA_IF">BOOST_PP_COMMA_IF</a>(0)</code> expands to nothing.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2><a name="BOOST_PREPROCESSOR_COMMA_IF">#define BOOST_PREPROCESSOR_COMMA_IF</a>(C)</h2>
|
||||
|
@ -30,6 +30,8 @@
|
||||
<p>Expands to <code>1</code> if <code>X == Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code><a href="comparison_equal.htm#BOOST_PP_EQUAL">BOOST_PP_EQUAL</a>(4,4)</code> expands to <code>1</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>()</li>
|
||||
|
@ -30,6 +30,8 @@
|
||||
<p>Expands to <code>1</code> if <code>X > Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code><a href="comparison_greater.htm#BOOST_PP_GREATER">BOOST_PP_GREATER</a>(4,3)</code> expands to <code>1</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>()</li>
|
||||
|
@ -30,6 +30,8 @@
|
||||
<p>Expands to <code>1</code> if <code>X >= Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code><a href="comparison_greater_equal.htm#BOOST_PP_GREATER_EQUAL">BOOST_PP_GREATER_EQUAL</a>(1,3)</code> expands to <code>0</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>()</li>
|
||||
|
@ -30,6 +30,8 @@
|
||||
<p>Expands to <code>1</code> if <code>X < Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code><a href="comparison_less.htm#BOOST_PP_LESS">BOOST_PP_LESS</a>(2,6)</code> expands to <code>1</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>()</li>
|
||||
|
@ -30,6 +30,8 @@
|
||||
<p>Expands to <code>1</code> if <code>X <= Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code><a href="comparison_less_equal.htm#BOOST_PP_LESS_EQUAL">BOOST_PP_LESS_EQUAL</a>(7,5)</code> expands to <code>0</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>()</li>
|
||||
|
@ -30,6 +30,8 @@
|
||||
<p>Expands to <code>1</code> if <code>X != Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code><a href="comparison_not_equal.htm#BOOST_PP_NOT_EQUAL">BOOST_PP_NOT_EQUAL</a>(4,4)</code> expands to <code>0</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="while.htm#BOOST_PP_WHILE">BOOST_PP_WHILE</a>()</li>
|
||||
|
@ -27,7 +27,15 @@
|
||||
<hr>
|
||||
|
||||
<h2><a name="BOOST_PP_EMPTY">#define BOOST_PP_EMPTY</a>()</h2>
|
||||
<p>Expands to nothing. Used with <a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>() and as an unused parameter.</p>
|
||||
<p>Expands to nothing.</p>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
<a href="if.htm#BOOST_PP_IF">BOOST_PP_IF</a>(0,<a href="comma.htm#BOOST_PP_COMMA">BOOST_PP_COMMA</a>,<a href="empty.htm#BOOST_PP_EMPTY">BOOST_PP_EMPTY</a>)()
|
||||
</pre>
|
||||
|
||||
<p>expands to nothing.</p>
|
||||
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
|
@ -35,6 +35,20 @@
|
||||
F(0,P), F(1,P), ..., F(<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(N),P)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TYPED_PARAM(I,P)\
|
||||
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,P),I) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,P),I)
|
||||
<a href="enum.htm#BOOST_PP_ENUM">BOOST_PP_ENUM</a>(3,TYPED_PARAM,(X,x))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
X0 x0, X1 x1, X2 x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>()</li>
|
||||
|
@ -35,6 +35,18 @@
|
||||
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,0), <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,1), ..., <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(N))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
<a href="enum_params.htm#BOOST_PP_ENUM_PARAMS">BOOST_PP_ENUM_PARAMS</a>(3,x)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x0, x1, x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>()</li>
|
||||
|
@ -35,6 +35,18 @@
|
||||
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,0) = D, <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,1) = D, ..., <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(N)) = D
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
<a href="enum_params_with_a_default.htm#BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT">BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT</a>(3,x,y)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x0 = y, x1 = y, x2 = y
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>()</li>
|
||||
|
@ -38,6 +38,18 @@
|
||||
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(N)) = <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(D,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(N))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
<a href="enum_params_with_defaults.htm#BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS">BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS</a>(3,x,y)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x0 = y0, x1 = y1, x2 = y2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>()</li>
|
||||
|
@ -35,6 +35,20 @@
|
||||
F(1,P), F(2,P), ..., F(<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(N),P)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TYPED_PARAM(I,P)\
|
||||
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,0,P),I) <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(<a href="tuple_elem.htm#BOOST_PP_TUPLE_ELEM">BOOST_PP_TUPLE_ELEM</a>(2,1,P),I)
|
||||
<a href="enum_shifted.htm#BOOST_PP_ENUM_SHIFTED">BOOST_PP_ENUM_SHIFTED</a>(3,TYPED_PARAM,(X,x))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
X1 x1, X2 x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li><a href="repeat.htm#BOOST_PP_REPEAT">BOOST_PP_REPEAT</a>()</li>
|
||||
|
@ -34,6 +34,17 @@
|
||||
<pre>
|
||||
<a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,1), <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,2), ..., <a href="cat.htm#BOOST_PP_CAT">BOOST_PP_CAT</a>(P,<a href="dec.htm#BOOST_PP_DEC">BOOST_PP_DEC</a>(N))
|
||||
</pre>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
<a href="enum_shifted_params.htm#BOOST_PP_ENUM_SHIFTED_PARAMS">BOOST_PP_ENUM_SHIFTED_PARAMS</a>(3,x)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x1, x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
|
@ -55,6 +55,21 @@
|
||||
by the C++ preprocessor.</li>
|
||||
</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>
|
||||
|
||||
<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
|
||||
|
@ -29,6 +29,8 @@
|
||||
<h2><a name="BOOST_PP_IF_THEN">#define BOOST_PP_IF_THEN</a>(C,T)</h2>
|
||||
<p>Expands to <code>T</code> if <code>C != 0</code> and to nothing if <code>C == 0</code>.</p>
|
||||
|
||||
<p>For example, <code><a href="if_then.htm#BOOST_PP_IF_THEN">BOOST_PP_IF_THEN</a>(1,^)</code> expands to <code>^</code>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<a href="if.htm">Prev</a> <a href="inc.htm">Next</a> <a href="index.htm#Macros">Macros</a> <a href="index.htm#Headers">Headers</a>
|
||||
|
@ -17,7 +17,10 @@
|
||||
#include <boost/preprocessor/logical/not.hpp>
|
||||
|
||||
/** <p>Expands to nothing if <code>C != 0</code> and to <code>MSG</code> if
|
||||
<code>C == 0</code>.</p> */
|
||||
<code>C == 0</code>.</p>
|
||||
|
||||
<p>For example, <code>BOOST_PP_ASSERT_MSG(1,A BUG!)</code> expands to <code>A BUG!</code>.</p>
|
||||
*/
|
||||
#define BOOST_PP_ASSERT_MSG(C,MSG) BOOST_PP_IF_THEN(BOOST_PP_NOT(C),MSG)
|
||||
|
||||
/** <p>Obsolete. Use BOOST_PP_ASSERT_MSG().</p> */
|
||||
|
@ -16,6 +16,8 @@
|
||||
/** <p>Concatenates <code>X</code> and <code>Y</code> after they are macro
|
||||
expanded.</p>
|
||||
|
||||
<p>For example, <code>BOOST_PP_CAT(A,BOOST_PP_CAT(_,B))</code> expands to <code>A_B</code>.</p>
|
||||
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/static_assert.c">static_assert.c</a></li>
|
||||
|
@ -13,7 +13,18 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <p>Expands to a comma. Can be used with BOOST_PP_IF().</p>
|
||||
/** <p>Expands to a comma.</p>
|
||||
|
||||
<p>Commas need special handling in preprocessor code, because commas are used
|
||||
for separating macro parameters.</p>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_IF(1,BOOST_PP_COMMA,BOOST_PP_EMPTY)()
|
||||
</pre>
|
||||
|
||||
<p>expands to a comma.</p>
|
||||
|
||||
<h3>See</h3>
|
||||
<ul>
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
/** <p>Expands to a comma if <code>C != 0</code> and nothing if
|
||||
<code>C == 0</code>.</p>
|
||||
|
||||
<p>For example, <code>BOOST_PP_COMMA_IF(0)</code> expands to nothing.</p>
|
||||
*/
|
||||
#define BOOST_PP_COMMA_IF(C) BOOST_PP_IF(C,BOOST_PP_COMMA,BOOST_PP_EMPTY)()
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
/** <p>Expands to <code>1</code> if <code>X == Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code>BOOST_PP_EQUAL(4,4)</code> expands to <code>1</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
|
@ -18,6 +18,8 @@
|
||||
/** <p>Expands to <code>1</code> if <code>X > Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code>BOOST_PP_GREATER(4,3)</code> expands to <code>1</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
|
@ -18,6 +18,8 @@
|
||||
/** <p>Expands to <code>1</code> if <code>X >= Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code>BOOST_PP_GREATER_EQUAL(1,3)</code> expands to <code>0</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
|
@ -20,6 +20,8 @@
|
||||
/** <p>Expands to <code>1</code> if <code>X < Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code>BOOST_PP_LESS(2,6)</code> expands to <code>1</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
|
@ -19,6 +19,8 @@
|
||||
/** <p>Expands to <code>1</code> if <code>X <= Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code>BOOST_PP_LESS_EQUAL(7,5)</code> expands to <code>0</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
|
@ -20,6 +20,8 @@
|
||||
/** <p>Expands to <code>1</code> if <code>X != Y</code> and <code>0</code>
|
||||
otherwise.</p>
|
||||
|
||||
<p>For example, <code>BOOST_PP_NOT_EQUAL(4,4)</code> expands to <code>0</code>.</p>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_WHILE()</li>
|
||||
|
@ -13,7 +13,15 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <p>Expands to nothing. Used with BOOST_PP_IF() and as an unused parameter.</p>
|
||||
/** <p>Expands to nothing.</p>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_IF(0,BOOST_PP_COMMA,BOOST_PP_EMPTY)()
|
||||
</pre>
|
||||
|
||||
<p>expands to nothing.</p>
|
||||
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
|
@ -25,6 +25,20 @@
|
||||
F(0,P), F(1,P), ..., F(BOOST_PP_DEC(N),P)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TYPED_PARAM(I,P)\
|
||||
BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,P),I) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,P),I)
|
||||
BOOST_PP_ENUM(3,TYPED_PARAM,(X,x))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
X0 x0, X1 x1, X2 x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
|
@ -24,6 +24,18 @@
|
||||
BOOST_PP_CAT(P,0), BOOST_PP_CAT(P,1), ..., BOOST_PP_CAT(P,BOOST_PP_DEC(N))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_ENUM_PARAMS(3,x)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x0, x1, x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
|
@ -24,6 +24,18 @@
|
||||
BOOST_PP_CAT(P,0) = D, BOOST_PP_CAT(P,1) = D, ..., BOOST_PP_CAT(P,BOOST_PP_DEC(N)) = D
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(3,x,y)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x0 = y, x1 = y, x2 = y
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
|
@ -27,6 +27,18 @@
|
||||
BOOST_PP_CAT(P,BOOST_PP_DEC(N)) = BOOST_PP_CAT(D,BOOST_PP_DEC(N))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS(3,x,y)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x0 = y0, x1 = y1, x2 = y2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
|
@ -25,6 +25,20 @@
|
||||
F(1,P), F(2,P), ..., F(BOOST_PP_DEC(N),P)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TYPED_PARAM(I,P)\
|
||||
BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,P),I) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,P),I)
|
||||
BOOST_PP_ENUM_SHIFTED(3,TYPED_PARAM,(X,x))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
X1 x1, X2 x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
<li>BOOST_PP_REPEAT()</li>
|
||||
|
@ -23,6 +23,17 @@
|
||||
<pre>
|
||||
BOOST_PP_CAT(P,1), BOOST_PP_CAT(P,2), ..., BOOST_PP_CAT(P,BOOST_PP_DEC(N))
|
||||
</pre>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_ENUM_SHIFTED_PARAMS(3,x)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x1, x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
<ul>
|
||||
|
@ -44,6 +44,21 @@
|
||||
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
|
||||
|
@ -13,10 +13,16 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
#include <boost/preprocessor/empty.hpp>
|
||||
#include <boost/preprocessor/if.hpp>
|
||||
#include <boost/preprocessor/logical/bool.hpp>
|
||||
|
||||
/** <p>Expands to <code>T</code> if <code>C != 0</code> and to nothing if <code>C == 0</code>.</p>
|
||||
|
||||
<p>For example, <code>BOOST_PP_IF_THEN(1,^)</code> expands to <code>^</code>.</p>
|
||||
*/
|
||||
#define BOOST_PP_IF_THEN(C,T) BOOST_PP_IF(C,T BOOST_PP_EMPTY,BOOST_PP_EMPTY)()
|
||||
#define BOOST_PP_IF_THEN(C,T) BOOST_PP_IF_THEN_BOOL(BOOST_PP_BOOL(C),T)
|
||||
|
||||
#define BOOST_PP_IF_THEN_BOOL(C,T) BOOST_PP_IF_THEN_BOOL_DELAY(C,T)
|
||||
#define BOOST_PP_IF_THEN_BOOL_DELAY(C,T) BOOST_PP_IF_THEN_BOOL##C(T)
|
||||
#define BOOST_PP_IF_THEN_BOOL0(T)
|
||||
#define BOOST_PP_IF_THEN_BOOL1(T) T
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user