1 | <html> |
---|
2 | <head> |
---|
3 | <title>BOOST_PP_EXPAND</title> |
---|
4 | <link rel="stylesheet" type="text/css" href="../styles.css"> |
---|
5 | </head> |
---|
6 | <body> |
---|
7 | <div style="margin-left: 0px;"> |
---|
8 | The <b>BOOST_PP_EXPAND</b> macro performs a double macro-expansion on its argument. |
---|
9 | </div> |
---|
10 | <h4>Usage</h4> |
---|
11 | <div class="code"> |
---|
12 | <b>BOOST_PP_EXPAND</b>(<i>x</i>) |
---|
13 | </div> |
---|
14 | <h4>Arguments</h4> |
---|
15 | <dl> |
---|
16 | <dt>x</dt> |
---|
17 | <dd> |
---|
18 | The argument to be expanded twice. |
---|
19 | </dd> |
---|
20 | </dl> |
---|
21 | <h4>Remarks</h4> |
---|
22 | <div> |
---|
23 | This macro is useful when a delay is necessary to produce the correct semantics of a macro invocation. |
---|
24 | For example, when a macro expands to an argument list to another macro. |
---|
25 | This macro will expand the the argument list on the first pass, and then rescan to expand any more macros. |
---|
26 | </div> |
---|
27 | <h4>Requirements</h4> |
---|
28 | <div> |
---|
29 | <b>Header:</b> <a href="../headers/facilities/expand.html"><boost/preprocessor/facilities/expand.hpp></a> |
---|
30 | </div> |
---|
31 | <h4>Sample Code</h4> |
---|
32 | <div><pre> |
---|
33 | #include <<a href="../headers/control/if.html">boost/preprocessor/control/if.hpp</a>> |
---|
34 | #include <<a href="../headers/facilities/expand.html">boost/preprocessor/facilities/expand.hpp</a>> |
---|
35 | |
---|
36 | #define MACRO(a, b, c) (a)(b)(c) |
---|
37 | #define ARGS() (1, 2, 3) |
---|
38 | |
---|
39 | <a href="expand.html">BOOST_PP_EXPAND</a>(MACRO ARGS()) // expands to (1)(2)(3) |
---|
40 | |
---|
41 | #define SAMPLE(n) \ |
---|
42 | <a href="expand.html">BOOST_PP_EXPAND</a>( \ |
---|
43 | MACRO \ |
---|
44 | <a href="if.html">BOOST_PP_IF</a>( \ |
---|
45 | n, \ |
---|
46 | (x, y, z), \ |
---|
47 | (a, b, c) \ |
---|
48 | ) \ |
---|
49 | ) \ |
---|
50 | /**/ |
---|
51 | |
---|
52 | SAMPLE(0) // expands to (a)(b)(c) |
---|
53 | SAMPLE(1) // expands to (x)(y)(z) |
---|
54 | </pre></div> |
---|
55 | <hr size="1"> |
---|
56 | <div style="margin-left: 0px;"> |
---|
57 | <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i> |
---|
58 | </br><i>© Copyright Paul Mensonides 2002</i> |
---|
59 | </div> |
---|
60 | <div style="margin-left: 0px;"> |
---|
61 | <p><small>Distributed under the Boost Software License, Version 1.0. (See |
---|
62 | accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or |
---|
63 | copy at <a href= |
---|
64 | "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p> |
---|
65 | </div> |
---|
66 | </body> |
---|
67 | </html> |
---|