seq_for_each_i.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <html>
  2. <head>
  3. <title>BOOST_PP_SEQ_FOR_EACH_I</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_SEQ_FOR_EACH_I</b> macro repeats a macro for each element in a <i>seq</i>.
  9. </div>
  10. <h4>
  11. Usage
  12. </h4>
  13. <div class="code">
  14. <b>BOOST_PP_SEQ_FOR_EACH_I</b>(<i>macro</i>, <i>data</i>, <i>seq</i>)
  15. </div>
  16. <h4>
  17. Arguments
  18. </h4>
  19. <dl>
  20. <dt>macro</dt>
  21. <dd>
  22. A macro of the form <i>macro</i>(<i>r</i>, <i>data</i>, <i>i</i>, <i>elem</i>).&nbsp;
  23. This macro is expanded by <b>BOOST_PP_SEQ_FOR_EACH_I</b> with each element in <i>seq</i>.&nbsp;
  24. It is expanded with the next available <b>BOOST_PP_FOR</b> repetition, the
  25. auxiliary <i>data</i>, the index of the current element, and the current
  26. element.
  27. </dd>
  28. <dt>data</dt>
  29. <dd>
  30. Auxiliary data passed to <i>macro</i>.
  31. </dd>
  32. <dt>seq</dt>
  33. <dd>
  34. The <i>seq</i> for which <i>macro</i> will be invoked on each element.
  35. </dd>
  36. </dl>
  37. <h4>
  38. Remarks
  39. </h4>
  40. <div>
  41. This macro is a repetition construct.&nbsp; If <i>seq</i> is (<i>a</i>)(<i>b</i>)(<i>c</i>),
  42. it expands to the sequence:
  43. <div>
  44. <i>macro</i>(<i>r</i>, <i>data</i>, <i>0</i>, <i>a</i>) <i>macro</i>(<i>r</i>, <i>data</i>,
  45. <i>1</i>, <i>b</i>) <i>macro</i>(<i>r</i>, <i>data</i>, <i>2</i>, <i>c</i>)
  46. </div>
  47. </div>
  48. <div>
  49. For maximum efficiency, use <b>BOOST_PP_SEQ_FOR_EACH_I_R</a></li>
  50. </div>
  51. <h4>
  52. See Also
  53. </h4>
  54. <ul>
  55. <li>
  56. <a href="seq_for_each_i_r.html">BOOST_PP_SEQ_FOR_EACH_I_R</a></li>
  57. </ul>
  58. <h4>
  59. Requirements
  60. </h4>
  61. <div>
  62. <b>Header:</b> &nbsp;<a href="../headers/seq/for_each_i.html">&lt;boost/preprocessor/seq/for_each_i.hpp&gt;</a>
  63. </div>
  64. <h4>
  65. Sample Code
  66. </h4>
  67. <div>
  68. <pre>
  69. #include &lt;<a href="../headers/cat.html">boost/preprocessor/cat.hpp</a>&gt;
  70. #include &lt;<a href="../headers/seq/for_each_i.html">boost/preprocessor/seq/for_each_i.hpp</a>&gt;
  71. #define SEQ (a)(b)(c)(d)
  72. #define MACRO(r, data, i, elem) <a href="cat.html">BOOST_PP_CAT</a>(elem, <a href="cat.html">BOOST_PP_CAT</a>(data, i))
  73. <a href="seq_for_each_i.html">BOOST_PP_SEQ_FOR_EACH_I</a>(MACRO, _, SEQ) // expands to a_0 b_1 c_2 d_3
  74. </pre>
  75. </div>
  76. <hr size="1">
  77. <div style="margin-left: 0px;">
  78. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  79. </br><i>© Copyright Paul Mensonides 2002</i>
  80. </div>
  81. <div style="margin-left: 0px;">
  82. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  83. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  84. copy at <a href=
  85. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  86. </div>
  87. </body>
  88. </html>