apply.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <html>
  2. <head>
  3. <title>BOOST_PP_APPLY</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_APPLY</b> macro abstracts the difference between an argument and nothing.
  9. </div>
  10. <h4>Usage</h4>
  11. <div class="code">
  12. <b>BOOST_PP_APPLY</b>(<i>x</i>)
  13. </div>
  14. <h4>Arguments</h4>
  15. <dl>
  16. <dt>x</dt>
  17. <dd>
  18. The abstracted argument.&nbsp;
  19. This argument must be either <b>BOOST_PP_NIL</b> or a <i>tuple</i> with one element--such as <i>(arg)</i> or <i>((a, b))</i>.
  20. </dd>
  21. </dl>
  22. <h4>Remarks</h4>
  23. <div>
  24. If <i>x</i> is <b>BOOST_PP_NIL</b>, this macro expands to nothing.&nbsp;
  25. If <i>x</i> is a one element <i>tuple</i>, it expands to the contents of that <i>tuple</i>.
  26. </div>
  27. <h4>See Also</h4>
  28. <ul>
  29. <li><a href="nil.html">BOOST_PP_NIL</a></li>
  30. </ul>
  31. <h4>Requirements</h4>
  32. <div>
  33. <b>Header:</b> &nbsp;<a href="../headers/facilities/apply.html">&lt;boost/preprocessor/facilities/apply.hpp&gt;</a>
  34. </div>
  35. <h4>Sample Code</h4>
  36. <div><pre>
  37. #include &lt;<a href="../headers/facilities/apply.html">boost/preprocessor/facilities/apply.hpp</a>&gt;
  38. #include &lt;<a href="../headers/tuple/elem.html">boost/preprocessor/tuple/elem.hpp</a>&gt;
  39. #define CV(i) \
  40. <a href="apply.html">BOOST_PP_APPLY</a>( \
  41. <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>( \
  42. 4, i, \
  43. (<a href="nil.html">BOOST_PP_NIL</a>, (const), (volatile), (const volatile)) \
  44. ) \
  45. ) \
  46. /**/
  47. CV(0) // expands to nothing
  48. CV(1) // expands to const
  49. </pre></div>
  50. <hr size="1">
  51. <div style="margin-left: 0px;">
  52. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  53. </br><i>© Copyright Paul Mensonides 2002</i>
  54. </div>
  55. <div style="margin-left: 0px;">
  56. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  57. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  58. copy at <a href=
  59. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  60. </div>
  61. </body>
  62. </html>