Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/preprocessor/doc/ref/iterate.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 2.8 KB
Line 
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
51   #ifndef FILE_H_
52   #define FILE_H_
53
54   #include &lt;<a href="../headers/iteration/iterate.html">boost/preprocessor/iteration/iterate.hpp</a>&gt;
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</body>
72</html>
Note: See TracBrowser for help on using the repository browser.