enum_trailing_z.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <html>
  2. <head>
  3. <title>BOOST_PP_ENUM_TRAILING_z</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_ENUM_TRAILING_<i>z</i></b> macro represents a reentry into the <b>BOOST_PP_ENUM_TRAILING</b> repetition construct.
  9. </div>
  10. <h4>Usage</h4>
  11. <div class="code">
  12. <b>BOOST_PP_ENUM_TRAILING_</b> ## <i>z</i>(<i>count</i>, <i>macro</i>, <i>data</i>)
  13. </div>
  14. <h4>Arguments</h4>
  15. <dl>
  16. <dt>z</dt>
  17. <dd>
  18. The next available <b>BOOST_PP_REPEAT</b> dimension.
  19. </dd>
  20. <dt>count</dt>
  21. <dd>
  22. The number of repetitious calls to <i>macro</i>.&nbsp;
  23. Valid values range from <i>0</i> to <b>BOOST_PP_LIMIT_REPEAT</b>.
  24. </dd>
  25. <dt>macro</dt>
  26. <dd>
  27. A ternary operation of the form <i>macro</i>(<i>z</i>, <i>n</i>, <i>data</i>).&nbsp;
  28. This macro is expanded by <b>BOOST_PP_ENUM</b> with the next available repetition depth,
  29. the current repetition number, and the auxiliary <i>data</i> argument.&nbsp;
  30. </dd>
  31. <dt>data</dt>
  32. <dd>
  33. Auxiliary data passed to <i>macro</i>.
  34. </dd>
  35. </dl>
  36. <h4>Remarks</h4>
  37. <div>
  38. This macro expands to the sequence:
  39. <div>
  40. , <i>macro</i>(<i>z</i>, <i>0</i>, <i>data</i>), <i>macro</i>(<i>z</i>, <i>1</i>, <i>data</i>), ... <i>macro</i>(<i>z</i>, <i>count</i> - <i>1</i>, <i>data</i>)
  41. </div>
  42. </div>
  43. <div>
  44. At certain times, it may be necessary to perform the concatenation with <b>BOOST_PP_CAT</b> rather than the preprocessor token-pasting operator.&nbsp;
  45. This happens when the <i>z</i> value is a macro invocation itself.&nbsp;
  46. It needs a delay to allow it to expand.&nbsp;
  47. The syntax in such a scenario becomes:
  48. <div>
  49. <b>BOOST_PP_CAT</b>(<b>BOOST_PP_ENUM_TRAILING_</b>, <i>z</i>)(<i>count</i>, <i>macro</i>, <i>data</i>)
  50. </div>
  51. </div>
  52. <h4>See Also</h4>
  53. <ul>
  54. <li><a href="cat.html">BOOST_PP_CAT</a></li>
  55. <li><a href="enum_trailing.html">BOOST_PP_ENUM_TRAILING</a></li>
  56. <li><a href="limit_repeat.html">BOOST_PP_LIMIT_REPEAT</a></li>
  57. </ul>
  58. <h4>Requirements</h4>
  59. <div>
  60. <b>Header:</b> &nbsp;<a href="../headers/repetition/enum_trailing.html">&lt;boost/preprocessor/repetition/enum_trailing.hpp&gt;</a>
  61. </div>
  62. <h4>Sample Code</h4>
  63. <div><pre>
  64. #include &lt;<a href="../headers/repetition/enum.html">boost/preprocessor/repetition/enum.hpp</a>&gt;
  65. #include &lt;<a href="../headers/repetition/enum_trailing.html">boost/preprocessor/repetition/enum_trailing.hpp</a>&gt;
  66. #define TEXT(z, n, text) text
  67. #define TTP(z, n, _) \
  68. template&lt; \
  69. class <a href="enum_z.html">BOOST_PP_ENUM_TRAILING_</a> ## z(n, TEXT, class) \
  70. &gt; \
  71. class T ## n \
  72. /**/
  73. <a href="enum.html">BOOST_PP_ENUM</a>(3, TTP, nil)
  74. /*
  75. expands to...
  76. template&lt;class&gt; class T0,
  77. template&lt;class, class&gt; class T1,
  78. template&lt;class, class, class&gt; class T2
  79. */
  80. </pre></div>
  81. <hr size="1">
  82. <div style="margin-left: 0px;">
  83. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  84. </br><i>© Copyright Paul Mensonides 2002</i>
  85. </div>
  86. <div style="margin-left: 0px;">
  87. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  88. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  89. copy at <a href=
  90. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  91. </div>
  92. </body>
  93. </html>