seq_transform.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <html>
  2. <head>
  3. <title>BOOST_PP_SEQ_TRANSFORM</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_TRANSFORM</b> macro transforms each element in a <i>seq</i>
  9. according to a supplied transformation.
  10. </div>
  11. <h4>
  12. Usage
  13. </h4>
  14. <div class="code">
  15. <b>BOOST_PP_SEQ_TRANSFORM</b>(<i>op</i>, <i>data</i>, <i>seq</i>)
  16. </div>
  17. <h4>
  18. Arguments
  19. </h4>
  20. <dl>
  21. <dt>op</dt>
  22. <dd>
  23. A ternary predicate of the form <i>op</i>(<i>s</i>, <i>data</i>, <i>elem</i>).&nbsp;
  24. This transformation is expanded by <b>BOOST_PP_SEQ_TRANSFORM</b> for each
  25. element in <i>seq</i> with the next available <b>BOOST_PP_SEQ_FOLD_LEFT</b> fold
  26. step, the auxiliary <i>data</i>, and the current element in <i>seq</i>.&nbsp;
  27. </dd>
  28. <dt>data</dt>
  29. <dd>
  30. Auxiliary data passed to <i>pred</i>.
  31. </dd>
  32. <dt>seq</dt>
  33. <dd>
  34. The <i>seq</i> to be transformed.
  35. </dd>
  36. </dl>
  37. <h4>
  38. Remarks
  39. </h4>
  40. <div>
  41. This macro expands <i>op</i> for each element in <i>seq</i>.&nbsp; It builds a
  42. new <i>seq</i> out of the results of each call.&nbsp; If, for example, <i>seq</i>
  43. is (<i>a</i>)(<i>b</i>)(<i>c</i>), this macro expands to...
  44. <div>
  45. (<i>op</i>(<i>d</i>, <i>data</i>, <i>a</i>))(<i>op</i>(<i>d</i>, <i>data</i>, <i>b</i>))(<i>op</i>(<i>d</i>,
  46. <i>data</i>, <i>c</i>))
  47. </div>
  48. </div>
  49. <div>
  50. For maximum efficiency, use <b>BOOST_PP_SEQ_TRANSFORM_S</b>.
  51. </div>
  52. <h4>
  53. See Also
  54. </h4>
  55. <ul>
  56. <li>
  57. <a href="seq_transform_s.html">BOOST_PP_SEQ_TRANSFORM_S</a></li>
  58. </ul>
  59. <h4>
  60. Requirements
  61. </h4>
  62. <div>
  63. <b>Header:</b> &nbsp;<a href="../headers/seq/transform.html">&lt;boost/preprocessor/seq/transform.hpp&gt;</a>
  64. </div>
  65. <h4>
  66. Sample Code
  67. </h4>
  68. <div>
  69. <pre>
  70. #include &lt;<a href="../headers/arithmetic/dec.html">boost/preprocessor/arithmetic/dec.hpp</a>&gt;
  71. #include &lt;<a href="../headers/seq/transform.html">boost/preprocessor/seq/transform.hpp</a>&gt;
  72. #define SEQ (1)(3)(2)(5)
  73. #define OP(s, data, elem) <a href="dec.html">BOOST_PP_DEC</a>(elem)
  74. <a href="seq_transform.html">BOOST_PP_SEQ_TRANSFORM</a>(OP, 3, SEQ)
  75. // expands to (0)(2)(1)(4)
  76. </pre>
  77. </div>
  78. <hr size="1">
  79. <div style="margin-left: 0px;">
  80. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  81. </br><i>© Copyright Paul Mensonides 2002</i>
  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> or
  86. copy at <a href=
  87. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  88. </div>
  89. </body>
  90. </html>