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