]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/preprocessor/doc/ref/list_for_each.html
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / preprocessor / doc / ref / list_for_each.html
1 <html>
2 <head>
3 <title>BOOST_PP_LIST_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_LIST_FOR_EACH</b> macro repeats a macro for each element in a <i>list</i>.
9 </div>
10 <h4>Usage</h4>
11 <div class="code">
12 <b>BOOST_PP_LIST_FOR_EACH</b>(<i>macro</i>, <i>data</i>, <i>list</i>)
13 </div>
14 <h4>Arguments</h4>
15 <dl>
16 <dt>macro</dt>
17 <dd>
18 A ternary macro of the form <i>macro</i>(<i>r</i>, <i>data</i>, <i>elem</i>).&nbsp;
19 This macro is expanded by <b>BOOST_PP_LIST_FOR_EACH</b> with each element in <i>list</i>.&nbsp;
20 It is expanded with the next available <b>BOOST_PP_FOR</b> repetition, the auxiliary <i>data</i>, and the current element.
21 </dd>
22 <dt>data</dt>
23 <dd>
24 Auxiliary data passed to <i>macro</i>.
25 </dd>
26 <dt>list</dt>
27 <dd>
28 The <i>list</i> for which <i>macro</i> will be invoked on each element.
29 </dd>
30 </dl>
31 <h4>Remarks</h4>
32 <div>
33 This macro is a repetition construct.&nbsp;
34 If <i>list</i> is (<i>a</i>, (<i>b</i>, (<i>c</i>, <b>BOOST_PP_NIL</b>))), it expands to the sequence:
35 <div>
36 <i>macro</i>(<i>r</i>, <i>data</i>, <i>a</i>) <i>macro</i>(<i>r</i>, <i>data</i>, <i>b</i>) <i>macro</i>(<i>r</i>, <i>data</i>, <i>c</i>)
37 </div>
38 </div>
39 <div>
40 Previously, this macro could not be used inside <b>BOOST_PP_FOR</b>.&nbsp;
41 There is no longer any such restriction.&nbsp;
42 It is more efficient, however, to use <b>BOOST_PP_LIST_FOR_EACH_R</b> in such a situation.
43 </div>
44 <h4>See Also</h4>
45 <ul>
46 <li><a href="list_for_each_r.html">BOOST_PP_LIST_FOR_EACH_R</a></li>
47 </ul>
48 <h4>Requirements</h4>
49 <div>
50 <b>Header:</b> &nbsp;<a href="../headers/list/for_each.html">&lt;boost/preprocessor/list/for_each.hpp&gt;</a>
51 </div>
52 <h4>Sample Code</h4>
53 <div><pre>
54 #include &lt;<a href="../headers/cat.html">boost/preprocessor/cat.hpp</a>&gt;
55 #include &lt;<a href="../headers/list/for_each.html">boost/preprocessor/list/for_each.hpp</a>&gt;
56
57 #define LIST (w, (x, (y, (z, <a href="nil.html">BOOST_PP_NIL</a>))))
58
59 #define MACRO(r, data, elem) <a href="cat.html">BOOST_PP_CAT</a>(elem, data)
60
61 <a href="list_for_each.html">BOOST_PP_LIST_FOR_EACH</a>(MACRO, _, LIST) // expands to w_ x_ y_ z_
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>