]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/preprocessor/doc/ref/list_for_each_product_r.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / preprocessor / doc / ref / list_for_each_product_r.html
1 <html>
2 <head>
3 <title>BOOST_PP_LIST_FOR_EACH_PRODUCT_R</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_PRODUCT_R</b> macro repeats a macro for each cartesian product of several <i>lists</i>.&nbsp;
9 It reenters <b>BOOST_PP_FOR</b> with maximum efficiency.
10 </div>
11 <h4>Usage</h4>
12 <div class="code">
13 <b>BOOST_PP_LIST_FOR_EACH_PRODUCT_R</b>(<i>r</i>, <i>macro</i>, <i>size</i>, <i>tuple</i>)
14 </div>
15 <h4>Arguments</h4>
16 <dl>
17 <dt>r</dt>
18 <dd>
19 The next available <b>BOOST_PP_FOR</b> repetition.
20 </dd>
21 <dt>macro</dt>
22 <dd>
23 The binary macro of the form <i>macro</i>(<i>r</i>, <i>product</i>).&nbsp;
24 This macro is expanded by <b>BOOST_PP_FOR_EACH_PRODUCT</b> with each cartesian product in <i>tuple</i>.&nbsp;
25 It is expanded with the next available <b>BOOST_PP_FOR</b> repetition and a <i>tuple</i> containing a cartesian product.&nbsp;
26 This <i>tuple</i> will have <i>size</i> elements.
27 </dd>
28 <dt>size</dt>
29 <dd>
30 The size of <i>tuple</i>.
31 </dd>
32 <dt>tuple</dt>
33 <dd>
34 A <i>tuple</i> of <i>lists</i> from which cartesian products are obtained.
35 </dd>
36 </dl>
37 <h4>Remarks</h4>
38 <div>
39 This macro is a repetition construct.&nbsp;
40 If two <i>lists</i> are (<i>a</i>, (<i>b</i>, (<i>c</i>, <b>BOOST_PP_NIL</b>))) and (<i>x</i>, (<i>y</i>, (<i>z</i>, <b>BOOST_PP_NIL</b>))),
41 this macro will produce the following sequence:
42 <div>
43 <i>macro</i>(<i>r</i>, (<i>a</i>, <i>x</i>))
44 <i>macro</i>(<i>r</i>, (<i>a</i>, <i>y</i>))
45 <i>macro</i>(<i>r</i>, (<i>a</i>, <i>z</i>))<br>
46 <i>macro</i>(<i>r</i>, (<i>b</i>, <i>x</i>))
47 <i>macro</i>(<i>r</i>, (<i>b</i>, <i>y</i>))
48 <i>macro</i>(<i>r</i>, (<i>b</i>, <i>z</i>))<br>
49 <i>macro</i>(<i>r</i>, (<i>c</i>, <i>x</i>))
50 <i>macro</i>(<i>r</i>, (<i>c</i>, <i>y</i>))
51 <i>macro</i>(<i>r</i>, (<i>c</i>, <i>z</i>))
52 </div>
53 </div>
54 <h4>See Also</h4>
55 <ul>
56 <li><a href="list_for_each_product.html">BOOST_PP_LIST_FOR_EACH_PRODUCT</a></li>
57 </ul>
58 <h4>Requirements</h4>
59 <div>
60 <b>Header:</b> &nbsp;<a href="../headers/list/for_each_product.html">&lt;boost/preprocessor/list/for_each_product.hpp&gt;</a>
61 </div>
62 <h4>Sample Code</h4>
63 <div><pre>
64 #include &lt;<a href="../headers/arithmetic/dec.html">boost/preprocessor/arithmetic/dec.hpp</a>&gt;
65 #include &lt;<a href="../headers/list/for_each_product.html">boost/preprocessor/list/for_each_product.hpp</a>&gt;
66 #include &lt;<a href="../headers/repetition/for.html">boost/preprocessor/repetition/for.hpp</a>&gt;
67 #include &lt;<a href="../headers/tuple/elem.html">boost/preprocessor/tuple/elem.hpp</a>&gt;
68
69 #define L1 (a, (b, <a href="nil.html">BOOST_PP_NIL</a>))
70 #define L2 (x, (y, <a href="nil.html">BOOST_PP_NIL</a>))
71
72 #define PRED(r, state) <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, 0, state)
73
74 #define OP(r, state) \
75 ( \
76 <a href="dec.html">BOOST_PP_DEC</a>( \
77 <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, 0, state) \
78 ), \
79 <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, 1, state) \
80 ) \
81 /**/
82
83 #define MACRO(r, state) \
84 MACRO_I( \
85 r, \
86 <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, 0, state), \
87 <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, 1, state) \
88 ) \
89 /**/
90
91 #define MACRO_I(r, c, t) \
92 <a href="list_for_each_product_r.html">BOOST_PP_LIST_FOR_EACH_PRODUCT_R</a>( \
93 r, MACRO_P, 2, \
94 ( \
95 <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, <a href="dec.html">BOOST_PP_DEC</a>(c), t), \
96 <a href="tuple_elem.html">BOOST_PP_TUPLE_ELEM</a>(2, <a href="dec.html">BOOST_PP_DEC</a>(c), t) \
97 ) \
98 ) \
99 /**/
100
101 #define MACRO_P(r, product) product
102
103 <a href="for.html">BOOST_PP_FOR</a>((2, (L1, L2)), PRED, OP, MACRO)
104 // expands to (x, x) (x, y) (y, x) (y, y) (a, a) (a, b) (b, a) (b, b)
105 </pre></div>
106 <hr size="1">
107 <div style="margin-left: 0px;">
108 <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
109 </br><i>© Copyright Paul Mensonides 2002</i>
110 </div>
111 <div style="margin-left: 0px;">
112 <p><small>Distributed under the Boost Software License, Version 1.0. (See
113 accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
114 copy at <a href=
115 "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
116 </div>
117 </body>
118 </html>