mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-15 13:36:33 +02:00
pre
[SVN r13974]
This commit is contained in:
@ -21,7 +21,7 @@ for separating macro parameters.</p>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_IF(1,BOOST_PP_COMMA,BOOST_PP_EMPTY)()
|
||||
BOOST_PP_IF(1,BOOST_PP_COMMA,BOOST_PP_EMPTY)()
|
||||
</pre>
|
||||
|
||||
<p>expands to a comma.</p>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_IF(0,BOOST_PP_COMMA,BOOST_PP_EMPTY)()
|
||||
BOOST_PP_IF(0,BOOST_PP_COMMA,BOOST_PP_EMPTY)()
|
||||
</pre>
|
||||
|
||||
<p>expands to nothing.</p>
|
||||
|
@ -22,21 +22,21 @@
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
MACRO(0,DATA), MACRO(1,DATA), ..., MACRO(BOOST_PP_DEC(COUNT),DATA)
|
||||
MACRO(0,DATA), MACRO(1,DATA), ..., MACRO(BOOST_PP_DEC(COUNT),DATA)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TYPED_PARAM(INDEX,DATA)\
|
||||
BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,DATA),INDEX) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,DATA),INDEX)
|
||||
BOOST_PP_ENUM(3,TYPED_PARAM,(X,x))
|
||||
#define TYPED_PARAM(INDEX,DATA)\
|
||||
BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,DATA),INDEX) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,DATA),INDEX)
|
||||
BOOST_PP_ENUM(3,TYPED_PARAM,(X,x))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
X0 x0, X1 x1, X2 x2
|
||||
X0 x0, X1 x1, X2 x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -21,19 +21,19 @@
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_CAT(PARAM,0), BOOST_PP_CAT(PARAM,1), ..., BOOST_PP_CAT(PARAM,BOOST_PP_DEC(COUNT))
|
||||
BOOST_PP_CAT(PARAM,0), BOOST_PP_CAT(PARAM,1), ..., BOOST_PP_CAT(PARAM,BOOST_PP_DEC(COUNT))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_ENUM_PARAMS(3,x)
|
||||
BOOST_PP_ENUM_PARAMS(3,x)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x0, x1, x2
|
||||
x0, x1, x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -21,22 +21,22 @@
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_CAT(PARAM,0) = DEFAULT,
|
||||
BOOST_PP_CAT(PARAM,1) = DEFAULT,
|
||||
...,
|
||||
BOOST_PP_CAT(PARAM,BOOST_PP_DEC(COUNT)) = DEFAULT
|
||||
BOOST_PP_CAT(PARAM,0) = DEFAULT,
|
||||
BOOST_PP_CAT(PARAM,1) = DEFAULT,
|
||||
...,
|
||||
BOOST_PP_CAT(PARAM,BOOST_PP_DEC(COUNT)) = DEFAULT
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(3,x,y)
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(3,x,y)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x0 = y, x1 = y, x2 = y
|
||||
x0 = y, x1 = y, x2 = y
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -21,22 +21,22 @@
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_CAT(PARAM,0) = BOOST_PP_CAT(DEFAULT,0),
|
||||
BOOST_PP_CAT(PARAM,1) = BOOST_PP_CAT(DEFAULT,1),
|
||||
...,
|
||||
BOOST_PP_CAT(PARAM,BOOST_PP_DEC(COUNT)) = BOOST_PP_CAT(DEFAULT,BOOST_PP_DEC(COUNT))
|
||||
BOOST_PP_CAT(PARAM,0) = BOOST_PP_CAT(DEFAULT,0),
|
||||
BOOST_PP_CAT(PARAM,1) = BOOST_PP_CAT(DEFAULT,1),
|
||||
...,
|
||||
BOOST_PP_CAT(PARAM,BOOST_PP_DEC(COUNT)) = BOOST_PP_CAT(DEFAULT,BOOST_PP_DEC(COUNT))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS(3,x,y)
|
||||
BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS(3,x,y)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x0 = y0, x1 = y1, x2 = y2
|
||||
x0 = y0, x1 = y1, x2 = y2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -22,21 +22,21 @@
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
MACRO(1,DATA), MACRO(2,DATA), ..., MACRO(BOOST_PP_DEC(COUNT),DATA)
|
||||
MACRO(1,DATA), MACRO(2,DATA), ..., MACRO(BOOST_PP_DEC(COUNT),DATA)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TYPED_PARAM(INDEX,DATA)\
|
||||
BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,DATA),INDEX) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,DATA),INDEX)
|
||||
BOOST_PP_ENUM_SHIFTED(3,TYPED_PARAM,(X,x))
|
||||
#define TYPED_PARAM(INDEX,DATA)\
|
||||
BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,DATA),INDEX) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,DATA),INDEX)
|
||||
BOOST_PP_ENUM_SHIFTED(3,TYPED_PARAM,(X,x))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
X1 x1, X2 x2
|
||||
X1 x1, X2 x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -21,18 +21,18 @@
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_CAT(PARAM,1), BOOST_PP_CAT(PARAM,2), ..., BOOST_PP_CAT(PARAM,BOOST_PP_DEC(COUNT))
|
||||
BOOST_PP_CAT(PARAM,1), BOOST_PP_CAT(PARAM,2), ..., BOOST_PP_CAT(PARAM,BOOST_PP_DEC(COUNT))
|
||||
</pre>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_ENUM_SHIFTED_PARAMS(3,x)
|
||||
BOOST_PP_ENUM_SHIFTED_PARAMS(3,x)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
x1, x2
|
||||
x1, x2
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -22,11 +22,11 @@
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
MACRO(R,STATE)
|
||||
MACRO(R,OP(R,STATE))
|
||||
MACRO(R,OP(R,OP(R,STATE)))
|
||||
...
|
||||
MACRO(R,OP(R,OP(...OP(R,STATE)...)))
|
||||
MACRO(R,STATE)
|
||||
MACRO(R,OP(R,STATE))
|
||||
MACRO(R,OP(R,OP(R,STATE)))
|
||||
...
|
||||
MACRO(R,OP(R,OP(...OP(R,STATE)...)))
|
||||
</pre>
|
||||
|
||||
<p>The length of the sequence is determined by <code>PRED(R,STATE)</code>.</p>
|
||||
@ -34,16 +34,16 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define PRED(R,STATE) BOOST_PP_LESS(BOOST_PP_TUPLE_ELEM(2,0,STATE),BOOST_PP_TUPLE_ELEM(2,1,STATE))
|
||||
#define OP(R,STATE) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,STATE)),BOOST_PP_TUPLE_ELEM(2,1,STATE))
|
||||
#define MACRO(R,STATE) BOOST_PP_TUPLE_ELEM(2,0,STATE)
|
||||
BOOST_PP_FOR((0,3),PRED,OP,MACRO)
|
||||
#define PRED(R,STATE) BOOST_PP_LESS(BOOST_PP_TUPLE_ELEM(2,0,STATE),BOOST_PP_TUPLE_ELEM(2,1,STATE))
|
||||
#define OP(R,STATE) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,STATE)),BOOST_PP_TUPLE_ELEM(2,1,STATE))
|
||||
#define MACRO(R,STATE) BOOST_PP_TUPLE_ELEM(2,0,STATE)
|
||||
BOOST_PP_FOR((0,3),PRED,OP,MACRO)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
0 1 2
|
||||
0 1 2
|
||||
</pre>
|
||||
|
||||
<h3>Legend</h3>
|
||||
|
@ -23,13 +23,13 @@ invoked.</p>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_IF(1,BOOST_PP_IDENTITY(X),BOOST_PP_EMPTY)<b>()</b>
|
||||
BOOST_PP_IF(1,BOOST_PP_IDENTITY(X),BOOST_PP_EMPTY)<b>()</b>
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
X
|
||||
X
|
||||
</pre>
|
||||
|
||||
<h3>Test</h3>
|
||||
|
@ -32,18 +32,18 @@
|
||||
BOOST_PP_LIST_CONS(). For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_CONS(1,
|
||||
BOOST_PP_LIST_CONS(2,
|
||||
BOOST_PP_LIST_CONS(3,
|
||||
BOOST_PP_LIST_CONS(4,
|
||||
BOOST_PP_LIST_CONS(5,
|
||||
BOOST_PP_LIST_NIL)))))
|
||||
BOOST_PP_LIST_CONS(1,
|
||||
BOOST_PP_LIST_CONS(2,
|
||||
BOOST_PP_LIST_CONS(3,
|
||||
BOOST_PP_LIST_CONS(4,
|
||||
BOOST_PP_LIST_CONS(5,
|
||||
BOOST_PP_LIST_NIL)))))
|
||||
</pre>
|
||||
|
||||
<p>Short lists can also be build from tuples:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(5,(1,2,3,4,5))
|
||||
BOOST_PP_TUPLE_TO_LIST(5,(1,2,3,4,5))
|
||||
</pre>
|
||||
|
||||
<p>Both of the above lists contain 5 elements: 1, 2, 3, 4 and 5.</p>
|
||||
@ -52,16 +52,16 @@ BOOST_PP_LIST_CONS(). For example,</p>
|
||||
and BOOST_PP_LIST_FOLD_RIGHT_2ND():</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_FOLD_RIGHT_2ND
|
||||
( BOOST_PP_LIST_APPEND_D
|
||||
, BOOST_PP_TUPLE_TO_LIST
|
||||
( N
|
||||
, BOOST_PP_TUPLE_TO_LIST(M, (E11, E12, ..., E1M) )
|
||||
, BOOST_PP_TUPLE_TO_LIST(M, (E21, E22, ..., E2M) )
|
||||
, ...
|
||||
, BOOST_PP_TUPLE_TO_LIST(M, (EN1, EN2, ..., ENM) )
|
||||
)
|
||||
BOOST_PP_LIST_FOLD_RIGHT_2ND
|
||||
( BOOST_PP_LIST_APPEND_D
|
||||
, BOOST_PP_TUPLE_TO_LIST
|
||||
( N
|
||||
, BOOST_PP_TUPLE_TO_LIST(M, (E11, E12, ..., E1M) )
|
||||
, BOOST_PP_TUPLE_TO_LIST(M, (E21, E22, ..., E2M) )
|
||||
, ...
|
||||
, BOOST_PP_TUPLE_TO_LIST(M, (EN1, EN2, ..., ENM) )
|
||||
)
|
||||
)
|
||||
</pre>
|
||||
*/
|
||||
#define BOOST_PP_LIST_CONS(FIRST,REST) (FIRST,REST,1)
|
||||
@ -88,7 +88,7 @@ and BOOST_PP_LIST_FOLD_RIGHT_2ND():</p>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_FIRST(BOOST_PP_TUPLE_TO_LIST(5,(1,2,3,4,5)))
|
||||
BOOST_PP_LIST_FIRST(BOOST_PP_TUPLE_TO_LIST(5,(1,2,3,4,5)))
|
||||
</pre>
|
||||
|
||||
<p>expands to 1.</p>
|
||||
@ -106,13 +106,13 @@ and BOOST_PP_LIST_FOLD_RIGHT_2ND():</p>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_REST(BOOST_PP_TUPLE_TO_LIST(5,(1,2,3,4,5)))
|
||||
BOOST_PP_LIST_REST(BOOST_PP_TUPLE_TO_LIST(5,(1,2,3,4,5)))
|
||||
</pre>
|
||||
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(4,(2,3,4,5))
|
||||
BOOST_PP_TUPLE_TO_LIST(4,(2,3,4,5))
|
||||
</pre>
|
||||
*/
|
||||
#if !defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__)
|
||||
|
@ -20,16 +20,16 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_APPEND
|
||||
( BOOST_PP_TUPLE_TO_LIST(2,(1,2))
|
||||
, BOOST_PP_TUPLE_TO_LIST(2,(3,4))
|
||||
)
|
||||
BOOST_PP_LIST_APPEND
|
||||
( BOOST_PP_TUPLE_TO_LIST(2,(1,2))
|
||||
, BOOST_PP_TUPLE_TO_LIST(2,(3,4))
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(4,(1,2,3,4))
|
||||
BOOST_PP_TUPLE_TO_LIST(4,(1,2,3,4))
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -21,7 +21,7 @@ first element is at index <code>0</code>.</p>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)),1)
|
||||
BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)),1)
|
||||
</pre>
|
||||
|
||||
<p>expands to <code>B</code>.</p>
|
||||
|
@ -21,13 +21,13 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_CAT(BOOST_PP_TUPLE_TO_LIST(3,(1,2,3)))
|
||||
BOOST_PP_LIST_CAT(BOOST_PP_TUPLE_TO_LIST(3,(1,2,3)))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
123
|
||||
123
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -21,13 +21,13 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_ENUM(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
BOOST_PP_LIST_ENUM(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
A,B,C
|
||||
A,B,C
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -21,13 +21,13 @@ for which <code>PRED(D,DATA,X)</code> is true.</p>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_FILTER(BOOST_PP_NOT_EQUAL_D,2,BOOST_PP_TUPLE_TO_LIST(3,(1,2,3)))
|
||||
BOOST_PP_LIST_FILTER(BOOST_PP_NOT_EQUAL_D,2,BOOST_PP_TUPLE_TO_LIST(3,(1,2,3)))
|
||||
</pre>
|
||||
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(1,3))
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(1,3))
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -23,13 +23,13 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_FIRST_N(2,BOOST_PP_TUPLE_TO_LIST(4,(+,-,*,/)))
|
||||
BOOST_PP_LIST_FIRST_N(2,BOOST_PP_TUPLE_TO_LIST(4,(+,-,*,/)))
|
||||
</pre>
|
||||
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(+,-))
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(+,-))
|
||||
</pre>
|
||||
|
||||
<h3>See</h3>
|
||||
|
@ -22,24 +22,24 @@ list <code>LIST</code> (from the left or the start of the list).</p>
|
||||
<p>In other words, expands to:</p>
|
||||
|
||||
<pre>
|
||||
OP
|
||||
( D
|
||||
, ... OP(D, OP(D,STATE,BOOST_PP_LIST_AT(LIST,0)), BOOST_PP_LIST_AT(LIST,1)) ...
|
||||
, BOOST_PP_LIST_AT(LIST,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST))
|
||||
)
|
||||
OP
|
||||
( D
|
||||
, ... OP(D, OP(D,STATE,BOOST_PP_LIST_AT(LIST,0)), BOOST_PP_LIST_AT(LIST,1)) ...
|
||||
, BOOST_PP_LIST_AT(LIST,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST))
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(D,STATE,X) BOOST_PP_CAT(STATE,X)
|
||||
BOOST_PP_LIST_FOLD_LEFT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
#define TEST(D,STATE,X) BOOST_PP_CAT(STATE,X)
|
||||
BOOST_PP_LIST_FOLD_LEFT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
_ABC
|
||||
_ABC
|
||||
</pre>
|
||||
|
||||
<h3>Note</h3>
|
||||
|
@ -21,32 +21,32 @@ list <code>LIST</code> (from the right or the end of the list).</p>
|
||||
<p>In other words, expands to:</p>
|
||||
|
||||
<pre>
|
||||
OP
|
||||
( D
|
||||
, BOOST_PP_LIST_AT(LIST,0)
|
||||
, ... OP
|
||||
OP
|
||||
( D
|
||||
, BOOST_PP_LIST_AT(LIST,0)
|
||||
, ... OP
|
||||
( D
|
||||
, BOOST_PP_LIST_AT(LIST,BOOST_PP_SUB(BOOST_PP_LIST_SIZE(LIST),2))
|
||||
, OP
|
||||
( D
|
||||
, BOOST_PP_LIST_AT(LIST,BOOST_PP_SUB(BOOST_PP_LIST_SIZE(LIST),2))
|
||||
, OP
|
||||
( D
|
||||
, BOOST_PP_LIST_AT(LIST,BOOST_PP_SUB(BOOST_PP_LIST_SIZE(LIST),1))
|
||||
, STATE
|
||||
)
|
||||
) ...
|
||||
)
|
||||
, BOOST_PP_LIST_AT(LIST,BOOST_PP_SUB(BOOST_PP_LIST_SIZE(LIST),1))
|
||||
, STATE
|
||||
)
|
||||
) ...
|
||||
)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(D,X,STATE) BOOST_PP_CAT(STATE,X)
|
||||
BOOST_PP_LIST_FOLD_RIGHT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
#define TEST(D,X,STATE) BOOST_PP_CAT(STATE,X)
|
||||
BOOST_PP_LIST_FOLD_RIGHT(TEST,_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
_CBA
|
||||
_CBA
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -21,23 +21,23 @@ BOOST_PP_LIST_SIZE(LIST)).</p>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
MACRO(R,DATA,BOOST_PP_LIST_AT(LIST,0))
|
||||
MACRO(R,DATA,BOOST_PP_LIST_AT(LIST,1))
|
||||
...
|
||||
MACRO(R,DATA,BOOST_PP_LIST_AT(LIST,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST))))
|
||||
MACRO(R,DATA,BOOST_PP_LIST_AT(LIST,0))
|
||||
MACRO(R,DATA,BOOST_PP_LIST_AT(LIST,1))
|
||||
...
|
||||
MACRO(R,DATA,BOOST_PP_LIST_AT(LIST,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST))))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(R,DATA,X) BOOST_PP_CAT(DATA,X)();
|
||||
BOOST_PP_LIST_FOR_EACH(TEST,prefix_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
#define TEST(R,DATA,X) BOOST_PP_CAT(DATA,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();
|
||||
prefix_A(); prefix_B(); prefix_C();
|
||||
</pre>
|
||||
|
||||
<h3>Example</h3>
|
||||
|
@ -23,23 +23,23 @@ BOOST_PP_LIST_SIZE(LIST)).</p>
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
MACRO(R,DATA,0,BOOST_PP_LIST_AT(LIST,0))
|
||||
MACRO(R,DATA,1,BOOST_PP_LIST_AT(LIST,1))
|
||||
...
|
||||
MACRO(R,DATA,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST)),BOOST_PP_LIST_AT(LIST,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST))))
|
||||
MACRO(R,DATA,0,BOOST_PP_LIST_AT(LIST,0))
|
||||
MACRO(R,DATA,1,BOOST_PP_LIST_AT(LIST,1))
|
||||
...
|
||||
MACRO(R,DATA,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST)),BOOST_PP_LIST_AT(LIST,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST))))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(R,DATA,INDEX,X) BOOST_PP_CAT(DATA,X)(INDEX);
|
||||
BOOST_PP_LIST_FOR_EACH_I(TEST,prefix_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
#define TEST(R,DATA,INDEX,X) BOOST_PP_CAT(DATA,X)(INDEX);
|
||||
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);
|
||||
prefix_A(0); prefix_B(1); prefix_C(2);
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -28,20 +28,20 @@ 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))
|
||||
)
|
||||
#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)
|
||||
(A,1) (A,2) (B,1) (B,2) (C,1) (C,2)
|
||||
</pre>
|
||||
|
||||
<h3>Example</h3>
|
||||
|
@ -23,13 +23,13 @@ list <code>LIST</code>.</p>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_REST_N(2,BOOST_PP_TUPLE_TO_LIST(4,(+,-,*,/)))
|
||||
BOOST_PP_LIST_REST_N(2,BOOST_PP_TUPLE_TO_LIST(4,(+,-,*,/)))
|
||||
</pre>
|
||||
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(*,/))
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(*,/))
|
||||
</pre>
|
||||
|
||||
<h3>See</h3>
|
||||
|
@ -20,13 +20,13 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_REVERSE(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
BOOST_PP_LIST_REVERSE(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</pre>
|
||||
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(3,(C,B,A))
|
||||
BOOST_PP_TUPLE_TO_LIST(3,(C,B,A))
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</pre>
|
||||
|
||||
<p>expands to <code>3</code>.</p>
|
||||
|
@ -20,7 +20,7 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_TO_TUPLE(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
BOOST_PP_LIST_TO_TUPLE(BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))
|
||||
</pre>
|
||||
|
||||
<p>expands to <code>(A,B,C)</code>.</p>
|
||||
|
@ -21,23 +21,23 @@ of the list producing a new list.</p>
|
||||
<p>In other words, expands to:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_CONS(OP(D,DATA,BOOST_PP_LIST_AT(LIST,0)),
|
||||
BOOST_PP_LIST_CONS(OP(D,DATA,BOOST_PP_LIST_AT(LIST,1)),
|
||||
...
|
||||
BOOST_PP_LIST_CONS(OP(D,DATA,BOOST_PP_LIST_AT(LIST,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST)))),
|
||||
BOOST_PP_LIST_NIL) ... ))
|
||||
BOOST_PP_LIST_CONS(OP(D,DATA,BOOST_PP_LIST_AT(LIST,0)),
|
||||
BOOST_PP_LIST_CONS(OP(D,DATA,BOOST_PP_LIST_AT(LIST,1)),
|
||||
...
|
||||
BOOST_PP_LIST_CONS(OP(D,DATA,BOOST_PP_LIST_AT(LIST,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST)))),
|
||||
BOOST_PP_LIST_NIL) ... ))
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D,2,BOOST_PP_TUPLE_TO_LIST(2,(1,2)))
|
||||
BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D,2,BOOST_PP_TUPLE_TO_LIST(2,(1,2)))
|
||||
</pre>
|
||||
|
||||
<p>expands to the same as:</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(3,4))
|
||||
BOOST_PP_TUPLE_TO_LIST(2,(3,4))
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -18,20 +18,20 @@
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
MACRO(0,DATA) MACRO(1,DATA) ... MACRO(BOOST_PP_DEC(COUNT),DATA)
|
||||
MACRO(0,DATA) MACRO(1,DATA) ... MACRO(BOOST_PP_DEC(COUNT),DATA)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(INDEX,DATA) DATA(INDEX);
|
||||
BOOST_PP_REPEAT(3,TEST,X)
|
||||
#define TEST(INDEX,DATA) DATA(INDEX);
|
||||
BOOST_PP_REPEAT(3,TEST,X)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
X(0); X(1); X(2);
|
||||
X(0); X(1); X(2);
|
||||
</pre>
|
||||
|
||||
<h3>2D and 3D repetition</h3>
|
||||
|
@ -22,20 +22,20 @@
|
||||
<p>In other words, expands to the sequence:</p>
|
||||
|
||||
<pre>
|
||||
MACRO(FIRST,DATA) MACRO(BOOST_PP_INC(FIRST),DATA) ... MACRO(BOOST_PP_DEC(LAST),DATA)
|
||||
MACRO(FIRST,DATA) MACRO(BOOST_PP_INC(FIRST),DATA) ... MACRO(BOOST_PP_DEC(LAST),DATA)
|
||||
</pre>
|
||||
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define TEST(INDEX,DATA) DATA(INDEX);
|
||||
BOOST_PP_REPEAT_FROM_TO(4,7,TEST,X)
|
||||
#define TEST(INDEX,DATA) DATA(INDEX);
|
||||
BOOST_PP_REPEAT_FROM_TO(4,7,TEST,X)
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
X(4); X(5); X(6);
|
||||
X(4); X(5); X(6);
|
||||
</pre>
|
||||
|
||||
<h3>Uses</h3>
|
||||
|
@ -24,9 +24,9 @@ constitutes a single macro parameter.</p>
|
||||
<p>Examples of tuples:</p>
|
||||
|
||||
<pre>
|
||||
(const, volatile) // 2-tuple
|
||||
(*, /, %) // 3-tuple
|
||||
(1, "2", '3', (4,5)) // 4-tuple
|
||||
(const, volatile) // 2-tuple
|
||||
(*, /, %) // 3-tuple
|
||||
(1, "2", '3', (4,5)) // 4-tuple
|
||||
</pre>
|
||||
|
||||
<p>Tuples can be used for representing structured data.</p>
|
||||
|
@ -21,7 +21,7 @@ BOOST_PP_EMPTY().</p>
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_IF(0,BOOST_PP_ENUM_PARAMS,BOOST_PP_TUPLE_EAT(2))(10,P)
|
||||
BOOST_PP_IF(0,BOOST_PP_ENUM_PARAMS,BOOST_PP_TUPLE_EAT(2))(10,P)
|
||||
</pre>
|
||||
|
||||
<p>expands to nothing.</p>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_ELEM(2,1,(A,B))
|
||||
BOOST_PP_TUPLE_ELEM(2,1,(A,B))
|
||||
</pre>
|
||||
|
||||
<p>expands to <code>B</code>.</p>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_REVERSE(3,(A,B,C))
|
||||
BOOST_PP_TUPLE_REVERSE(3,(A,B,C))
|
||||
</pre>
|
||||
|
||||
<p>expands to <code>(C,B,A)</code>.</p>
|
||||
|
@ -20,16 +20,16 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))
|
||||
BOOST_PP_TUPLE_TO_LIST(3,(A,B,C))
|
||||
</pre>
|
||||
|
||||
<p>expands to the same as</p>
|
||||
|
||||
<pre>
|
||||
BOOST_PP_LIST_CONS(A,
|
||||
BOOST_PP_LIST_CONS(B,
|
||||
BOOST_PP_LIST_CONS(C,
|
||||
BOOST_PP_LIST_NIL)))
|
||||
BOOST_PP_LIST_CONS(A,
|
||||
BOOST_PP_LIST_CONS(B,
|
||||
BOOST_PP_LIST_CONS(C,
|
||||
BOOST_PP_LIST_NIL)))
|
||||
</pre>
|
||||
|
||||
<h3>See</h3>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<p>In other words, expands to:</p>
|
||||
|
||||
<pre>
|
||||
OP(D, ... OP(D, OP(D,STATE) ) ... )
|
||||
OP(D, ... OP(D, OP(D,STATE) ) ... )
|
||||
</pre>
|
||||
|
||||
<p>The depth of iteration is determined by <code>PRED(D,STATE)</code>.</p>
|
||||
@ -29,15 +29,15 @@
|
||||
<p>For example,</p>
|
||||
|
||||
<pre>
|
||||
#define PRED(D,STATE) BOOST_PP_LESS_D(D,BOOST_PP_TUPLE_ELEM(2,0,STATE),BOOST_PP_TUPLE_ELEM(2,1,STATE))
|
||||
#define OP(D,STATE) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,STATE)),BOOST_PP_TUPLE_ELEM(2,1,STATE))
|
||||
BOOST_PP_WHILE(PRED,OP,(0,3))
|
||||
#define PRED(D,STATE) BOOST_PP_LESS_D(D,BOOST_PP_TUPLE_ELEM(2,0,STATE),BOOST_PP_TUPLE_ELEM(2,1,STATE))
|
||||
#define OP(D,STATE) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2,0,STATE)),BOOST_PP_TUPLE_ELEM(2,1,STATE))
|
||||
BOOST_PP_WHILE(PRED,OP,(0,3))
|
||||
</pre>
|
||||
|
||||
<p>expands to:</p>
|
||||
|
||||
<pre>
|
||||
(3,3)
|
||||
(3,3)
|
||||
</pre>
|
||||
|
||||
<h3>Legend</h3>
|
||||
|
Reference in New Issue
Block a user