seq_for_each.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <html>
  2. <head>
  3. <title>BOOST_PP_SEQ_FOR_EACH</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</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</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 ternary macro of the form <i>macro</i>(<i>r</i>, <i>data</i>, <i>elem</i>).&nbsp;
  23. This macro is expanded by <b>BOOST_PP_SEQ_FOR_EACH</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>, and the current element.
  26. </dd>
  27. <dt>data</dt>
  28. <dd>
  29. Auxiliary data passed to <i>macro</i>.
  30. </dd>
  31. <dt>seq</dt>
  32. <dd>
  33. The <i>seq</i> for which <i>macro</i> will be invoked on each element.
  34. </dd>
  35. </dl>
  36. <h4>
  37. Remarks
  38. </h4>
  39. <div>
  40. This macro is a repetition construct.&nbsp; If <i>seq</i> is (<i>a</i>)(<i>b</i>)(<i>c</i>),
  41. it expands to the sequence:
  42. <div>
  43. <i>macro</i>(<i>r</i>, <i>data</i>, <i>a</i>) <i>macro</i>(<i>r</i>, <i>data</i>,
  44. <i>b</i>) <i>macro</i>(<i>r</i>, <i>data</i>, <i>c</i>)
  45. </div>
  46. </div>
  47. <div>
  48. For maximum efficiency, use <b>BOOST_PP_SEQ_FOR_EACH_R</b>.
  49. </div>
  50. <h4>
  51. See Also
  52. </h4>
  53. <ul>
  54. <li>
  55. <a href="seq_for_each_r.html">BOOST_PP_SEQ_FOR_EACH_R</a></li>
  56. </ul>
  57. <h4>
  58. Requirements
  59. </h4>
  60. <div>
  61. <b>Header:</b> &nbsp;<a href="../headers/seq/for_each.html">&lt;boost/preprocessor/seq/for_each.hpp&gt;</a>
  62. </div>
  63. <h4>
  64. Sample Code
  65. </h4>
  66. <div>
  67. <pre>
  68. #include &lt;<a href="../headers/cat.html">boost/preprocessor/cat.hpp</a>&gt;
  69. #include &lt;<a href="../headers/seq/for_each.html">boost/preprocessor/seq/for_each.hpp</a>&gt;
  70. #define SEQ (w)(x)(y)(z)
  71. #define MACRO(r, data, elem) <a href="cat.html">BOOST_PP_CAT</a>(elem, data)
  72. <a href="seq_for_each.html">BOOST_PP_SEQ_FOR_EACH</a>(MACRO, _, SEQ) // expands to w_ x_ y_ z_
  73. </pre>
  74. </div>
  75. <hr size="1">
  76. <div style="margin-left: 0px;">
  77. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  78. </br><i>© Copyright Paul Mensonides 2002</i>
  79. </div>
  80. <div style="margin-left: 0px;">
  81. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  82. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  83. copy at <a href=
  84. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  85. </div>
  86. </body>
  87. </html>