comma_if.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <html>
  2. <head>
  3. <title>BOOST_PP_COMMA_IF</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_COMMA_IF</b> macro conditionally expands to a comma.
  9. </div>
  10. <h4>Usage</h4>
  11. <div class="code">
  12. <b>BOOST_PP_COMMA_IF</b>(<i>cond</i>)
  13. </div>
  14. <h4>Arguments</h4>
  15. <dl>
  16. <dt>cond</dt>
  17. <dd>
  18. The condition that determines if a the macro expands to a comma or nothing.&nbsp;
  19. Valid values range from <i>0</i> to <b>BOOST_PP_LIMIT_MAG</b>.
  20. </dd>
  21. </dl>
  22. <h4>Remarks</h4>
  23. <div>
  24. If <i>cond</i> expands to <i>0</i>, this macro expands to nothing.&nbsp;
  25. Otherwise, it expands to a comma.
  26. </div>
  27. <div>
  28. The preprocessor interprets commas as argument separators in macro invocations.&nbsp;
  29. Because of this, commas require special handling.
  30. </div>
  31. <h4>See Also</h4>
  32. <ul>
  33. <li><a href="limit_mag.html">BOOST_PP_LIMIT_MAG</a></li>
  34. </ul>
  35. <h4>Requirements</h4>
  36. <div>
  37. <b>Header:</b> &nbsp;<a href="../headers/punctuation/comma_if.html">&lt;boost/preprocessor/punctuation/comma_if.hpp&gt;</a>
  38. </div>
  39. <h4>Sample Code</h4>
  40. <div><pre>
  41. #include &lt;<a href="../headers/punctuation/comma_if.html">boost/preprocessor/punctuation/comma_if.hpp</a>&gt;
  42. #include &lt;<a href="../headers/repetition/repeat.html">boost/preprocessor/repetition/repeat.hpp</a>&gt;
  43. #define MACRO(z, n, text) <a href="comma_if.html">BOOST_PP_COMMA_IF</a>(n) text
  44. <a href="repeat.html">BOOST_PP_REPEAT</a>(3, MACRO, class) // expands to class, class, class
  45. </pre></div>
  46. <hr size="1">
  47. <div style="margin-left: 0px;">
  48. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  49. </br><i>© Copyright Paul Mensonides 2002</i>
  50. </div>
  51. <div style="margin-left: 0px;">
  52. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  53. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  54. copy at <a href=
  55. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  56. </div>
  57. </body>
  58. </html>