expand.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.&nbsp;
  24. For example, when a macro expands to an argument list to another macro.&nbsp;
  25. This macro will expand 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> &nbsp;<a href="../headers/facilities/expand.html">&lt;boost/preprocessor/facilities/expand.hpp&gt;</a>
  30. </div>
  31. <h4>Sample Code</h4>
  32. <div><pre>
  33. #include &lt;<a href="../headers/control/if.html">boost/preprocessor/control/if.hpp</a>&gt;
  34. #include &lt;<a href="../headers/facilities/expand.html">boost/preprocessor/facilities/expand.hpp</a>&gt;
  35. #define MACRO(a, b, c) (a)(b)(c)
  36. #define ARGS() (1, 2, 3)
  37. <a href="expand.html">BOOST_PP_EXPAND</a>(MACRO ARGS()) // expands to (1)(2)(3)
  38. #define SAMPLE(n) \
  39. <a href="expand.html">BOOST_PP_EXPAND</a>( \
  40. MACRO \
  41. <a href="if.html">BOOST_PP_IF</a>( \
  42. n, \
  43. (x, y, z), \
  44. (a, b, c) \
  45. ) \
  46. ) \
  47. /**/
  48. SAMPLE(0) // expands to (a)(b)(c)
  49. SAMPLE(1) // expands to (x)(y)(z)
  50. </pre></div>
  51. <hr size="1">
  52. <div style="margin-left: 0px;">
  53. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  54. </br><i>© Copyright Paul Mensonides 2002</i>
  55. </div>
  56. <div style="margin-left: 0px;">
  57. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  58. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  59. copy at <a href=
  60. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  61. </div>
  62. </body>
  63. </html>