Brian Silverman | f27e085 | 2018-08-04 23:56:45 -0700 | [diff] [blame^] | 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>. |
| 19 | </div> |
| 20 | <div> |
| 21 | Three pieces of information are required to perform a <i>file-iteration</i>. |
| 22 | First, the name of a file to iterate over. |
| 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>. |
| 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. |
| 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. |
| 29 | These flags are primarily useful to distinguish one iteration from another in the same file. |
| 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> <a href="../headers/iteration/iterate.html"><boost/preprocessor/iteration/iterate.hpp></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 | |
| 51 | #ifndef FILE_H_ |
| 52 | #define FILE_H_ |
| 53 | |
| 54 | #include <<a href="../headers/iteration/iterate.html">boost/preprocessor/iteration/iterate.hpp</a>> |
| 55 | |
| 56 | #define <a href="iteration_params_x.html">BOOST_PP_ITERATION_PARAMS_1</a> (3, (1, 10, "file.h")) |
| 57 | #include <a href="iterate.html">BOOST_PP_ITERATE</a>() |
| 58 | |
| 59 | #define <a href="filename_x.html">BOOST_PP_FILENAME_1</a> "file.h" |
| 60 | #define <a href="iteration_limits.html">BOOST_PP_ITERATION_LIMITS</a> (11, 20) |
| 61 | #include <a href="iterate.html">BOOST_PP_ITERATE</a>() |
| 62 | |
| 63 | #endif |
| 64 | |
| 65 | #else |
| 66 | |
| 67 | current iteration value is <a href="iteration.html">BOOST_PP_ITERATION</a>() |
| 68 | |
| 69 | #endif |
| 70 | </pre></div> |
| 71 | <hr size="1"> |
| 72 | <div style="margin-left: 0px;"> |
| 73 | <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i> |
| 74 | </br><i>© Copyright Paul Mensonides 2002</i> |
| 75 | </div> |
| 76 | <div style="margin-left: 0px;"> |
| 77 | <p><small>Distributed under the Boost Software License, Version 1.0. (See |
| 78 | accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or |
| 79 | copy at <a href= |
| 80 | "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p> |
| 81 | </div> |
| 82 | </body> |
| 83 | </html> |