identity.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <html>
  2. <head>
  3. <title>BOOST_PP_IDENTITY</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_IDENTITY</b> macro expands to its argument when invoked.
  9. </div>
  10. <h4>Usage</h4>
  11. <div class="code">
  12. <b>BOOST_PP_IDENTITY</b>(<i>item</i>)()
  13. </div>
  14. <h4>Arguments</h4>
  15. <dl>
  16. <dt>item</dt>
  17. <dd>
  18. The result of the expansion.
  19. </dd>
  20. </dl>
  21. <h4>Remarks</h4>
  22. <div>
  23. This macro is designed to be used with <b>BOOST_PP_IF</b> and <b>BOOST_PP_IIF</b> when only one of the clauses needs to be invoked.
  24. </div>
  25. <h4>See Also</h4>
  26. <ul>
  27. <li><a href="if.html">BOOST_PP_IF</a></li>
  28. <li><a href="iif.html">BOOST_PP_IIF</a></li>
  29. </ul>
  30. <h4>Requirements</h4>
  31. <div>
  32. <b>Header:</b> &nbsp;<a href="../headers/facilities/identity.html">&lt;boost/preprocessor/facilities/identity.hpp&gt;</a>
  33. </div>
  34. <h4>Sample Code</h4>
  35. <div><pre>
  36. #include &lt;<a href="../headers/control/if.html">boost/preprocessor/control/if.hpp</a>&gt;
  37. #include &lt;<a href="../headers/facilities/empty.html">boost/preprocessor/facilities/empty.hpp</a>&gt;
  38. #include &lt;<a href="../headers/facilities/identity.html">boost/preprocessor/facilities/identity.hpp</a>&gt;
  39. #define MACRO(n) <a href="if.html">BOOST_PP_IF</a>(n, <a href="identity.html">BOOST_PP_IDENTITY</a>(x), <a href="empty.html">BOOST_PP_EMPTY</a>)()
  40. MACRO(0) // expands to nothing
  41. MACRO(1) // expands to x
  42. </pre></div>
  43. <hr size="1">
  44. <div style="margin-left: 0px;">
  45. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  46. </br><i>© Copyright Paul Mensonides 2002</i>
  47. </div>
  48. <div style="margin-left: 0px;">
  49. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  50. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  51. copy at <a href=
  52. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  53. </div>
  54. </body>
  55. </html>