]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
3 | <title>BOOST_PP_SEQ_FOR_EACH_I</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_I</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_I</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 macro of the form <i>macro</i>(<i>r</i>, <i>data</i>, <i>i</i>, <i>elem</i>). | |
23 | This macro is expanded by <b>BOOST_PP_SEQ_FOR_EACH_I</b> with each element in <i>seq</i>. | |
24 | It is expanded with the next available <b>BOOST_PP_FOR</b> repetition, the | |
25 | auxiliary <i>data</i>, the index of the current element, and the current | |
26 | element. | |
27 | </dd> | |
28 | <dt>data</dt> | |
29 | <dd> | |
30 | Auxiliary data passed to <i>macro</i>. | |
31 | </dd> | |
32 | <dt>seq</dt> | |
33 | <dd> | |
34 | The <i>seq</i> for which <i>macro</i> will be invoked on each element. | |
35 | </dd> | |
36 | </dl> | |
37 | <h4> | |
38 | Remarks | |
39 | </h4> | |
40 | <div> | |
41 | This macro is a repetition construct. If <i>seq</i> is (<i>a</i>)(<i>b</i>)(<i>c</i>), | |
42 | it expands to the sequence: | |
43 | <div> | |
44 | <i>macro</i>(<i>r</i>, <i>data</i>, <i>0</i>, <i>a</i>) <i>macro</i>(<i>r</i>, <i>data</i>, | |
45 | <i>1</i>, <i>b</i>) <i>macro</i>(<i>r</i>, <i>data</i>, <i>2</i>, <i>c</i>) | |
46 | </div> | |
47 | </div> | |
48 | <div> | |
49 | For maximum efficiency, use <b>BOOST_PP_SEQ_FOR_EACH_I_R</a></li> | |
50 | </div> | |
51 | <h4> | |
52 | See Also | |
53 | </h4> | |
54 | <ul> | |
55 | <li> | |
56 | <a href="seq_for_each_i_r.html">BOOST_PP_SEQ_FOR_EACH_I_R</a></li> | |
57 | </ul> | |
58 | <h4> | |
59 | Requirements | |
60 | </h4> | |
61 | <div> | |
62 | <b>Header:</b> <a href="../headers/seq/for_each_i.html"><boost/preprocessor/seq/for_each_i.hpp></a> | |
63 | </div> | |
64 | <h4> | |
65 | Sample Code | |
66 | </h4> | |
67 | <div> | |
68 | <pre> | |
69 | #include <<a href="../headers/cat.html">boost/preprocessor/cat.hpp</a>> | |
70 | #include <<a href="../headers/seq/for_each_i.html">boost/preprocessor/seq/for_each_i.hpp</a>> | |
71 | ||
72 | #define SEQ (a)(b)(c)(d) | |
73 | ||
74 | #define MACRO(r, data, i, elem) <a href="cat.html">BOOST_PP_CAT</a>(elem, <a href="cat.html">BOOST_PP_CAT</a>(data, i)) | |
75 | ||
76 | <a href="seq_for_each_i.html">BOOST_PP_SEQ_FOR_EACH_I</a>(MACRO, _, SEQ) // expands to a_0 b_1 c_2 d_3 | |
77 | </pre> | |
78 | </div> | |
79 | <hr size="1"> | |
80 | <div style="margin-left: 0px;"> | |
81 |