iterate.html 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <html>
  2. <head>
  3. <title>BOOST_PP_ITERATE</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_ITERATE</b> macro initiates a <i>file-iteration</i>.
  9. </div>
  10. <h4>Usage</h4>
  11. <div class="code">
  12. #include <b>BOOST_PP_ITERATE</b>()
  13. </div>
  14. <h4>Remarks</h4>
  15. <div>
  16. Arguments to this macro are passed as <i>external named arguments</i> in one of two
  17. ways--either through <b>BOOST_PP_FILENAME_<i>x</i></b> and <b>BOOST_PP_ITERATION_LIMITS</b> <i>or</i>
  18. through <b>BOOST_PP_ITERATION_PARAMS_<i>x</i></b>.&nbsp;
  19. </div>
  20. <div>
  21. Three pieces of information are required to perform a <i>file-iteration</i>.&nbsp;
  22. First, the name of a file to iterate over.&nbsp;
  23. This is passed via <b>BOOST_PP_FILENAME_<i>x</i></b> <i>or</i> as part of <b>BOOST_PP_ITERATION_PARAMS_<i>x</i></b>.&nbsp;
  24. The <i>file-iteration</i> mechanism will repeatedly include this file with iteration values ranging from a lower bound to an upper bound--the second and third <i>required</i> parameters.&nbsp;
  25. These two boundaries are either passed through <b>BOOST_PP_ITERATION_LIMITS</b> <i>or</i> as part of <b>BOOST_PP_ITERATION_PARAMS_<i>x</i></b>.
  26. </div>
  27. <div>
  28. Optionally, a fourth parameter may be passed that associates flags with an iteration.&nbsp;
  29. These flags are primarily useful to distinguish one iteration from another in the same file.&nbsp;
  30. This parameter can only be passed through <b>BOOST_PP_ITERATION_PARAMS_<i>x</i></b>.
  31. </div>
  32. <div>
  33. While a <i>file-iteration</i> is in progress, <b>BOOST_PP_IS_ITERATING</b> is defined as <i>1</i>.
  34. </div>
  35. <h4>See Also</h4>
  36. <ul>
  37. <li><a href="filename_x.html">BOOST_PP_FILENAME_<i>x</i></a></li>
  38. <li><a href="is_iterating.html">BOOST_PP_IS_ITERATING</a></li>
  39. <li><a href="iteration_limits.html">BOOST_PP_ITERATION_LIMITS</a></li>
  40. <li><a href="iteration_params_x.html">BOOST_PP_ITERATION_PARAMS_<i>x</i></a></li>
  41. </ul>
  42. <h4>Requirements</h4>
  43. <div>
  44. <b>Header:</b> &nbsp;<a href="../headers/iteration/iterate.html">&lt;boost/preprocessor/iteration/iterate.hpp&gt;</a>
  45. </div>
  46. <h4>Sample Code</h4>
  47. <div><pre>
  48. // file.h
  49. #if !<a href="is_iterating.html">BOOST_PP_IS_ITERATING</a>
  50. #ifndef FILE_H_
  51. #define FILE_H_
  52. #include &lt;<a href="../headers/iteration/iterate.html">boost/preprocessor/iteration/iterate.hpp</a>&gt;
  53. #define <a href="iteration_params_x.html">BOOST_PP_ITERATION_PARAMS_1</a> (3, (1, 10, "file.h"))
  54. #include <a href="iterate.html">BOOST_PP_ITERATE</a>()
  55. #define <a href="filename_x.html">BOOST_PP_FILENAME_1</a> "file.h"
  56. #define <a href="iteration_limits.html">BOOST_PP_ITERATION_LIMITS</a> (11, 20)
  57. #include <a href="iterate.html">BOOST_PP_ITERATE</a>()
  58. #endif
  59. #else
  60. current iteration value is <a href="iteration.html">BOOST_PP_ITERATION</a>()
  61. #endif
  62. </pre></div>
  63. <hr size="1">
  64. <div style="margin-left: 0px;">
  65. <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
  66. </br><i>© Copyright Paul Mensonides 2002</i>
  67. </div>
  68. <div style="margin-left: 0px;">
  69. <p><small>Distributed under the Boost Software License, Version 1.0. (See
  70. accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
  71. copy at <a href=
  72. "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  73. </div>
  74. </body>
  75. </html>