repeat_z.html 3.9 KB

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