]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/preprocessor/doc/ref/seq_fold_right.html
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / preprocessor / doc / ref / seq_fold_right.html
1 <html>
2 <head>
3 <title>BOOST_PP_SEQ_FOLD_RIGHT</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_FOLD_RIGHT</b> macro folds (or accumulates) the elements of
9 a <i>seq</i> right-to-left.
10 </div>
11 <h4>
12 Usage
13 </h4>
14 <div class="code">
15 <b>BOOST_PP_SEQ_FOLD_RIGHT</b>(<i>op</i>, <i>state</i>, <i>seq</i>)
16 </div>
17 <h4>
18 Arguments
19 </h4>
20 <dl>
21 <dt>op</dt>
22 <dd>
23 A ternary operation of the form <i>op</i>(<i>s</i>, <i>state</i>, <i>elem</i>).&nbsp;
24 This macro is called for each element in <i>seq</i>--each time returning a new <i>state</i>.&nbsp;
25 This operation is expanded by <b>BOOST_PP_SEQ_FOLD_RIGHT</b> with the next
26 available fold step, the current <i>state</i>, and the current element.
27 </dd>
28 <dt>state</dt>
29 <dd>
30 The initial state of the fold.
31 </dd>
32 <dt>seq</dt>
33 <dd>
34 The <i>seq</i> to be folded.
35 </dd>
36 </dl>
37 <h4>
38 Remarks
39 </h4>
40 <div>
41 For the <i>seq</i>, (<i>0</i>)(<i>1</i>)(<i>2</i>), this macro expands to:
42 <div>
43 <i>op</i>(<i>s</i>, <i>op</i>(<i>s</i>, <i>op</i>(<i>s</i>, <i>state</i>, <i>2</i>),
44 <i>1</i>), <i>0</i>)
45 </div>
46 </div>
47 <div>
48 For maximum efficiency, <b>BOOST_PP_SEQ_FOLD_RIGHT</b> can be reentered with <b>BOOST_PP_SEQ_FOLD_RIGHT_<i>s</i></b>.
49 </div>
50 <h4>
51 See Also
52 </h4>
53 <ul>
54 <li>
55 <a href="seq_fold_right_s.html">BOOST_PP_SEQ_FOLD_RIGHT_<i>s</i></a></li>
56 </ul>
57 <h4>
58 Requirements
59 </h4>
60 <div>
61 <b>Header:</b> &nbsp;<a href="../headers/seq/fold_right.html">&lt;boost/preprocessor/seq/fold_right.hpp&gt;</a>
62 </div>
63 <h4>
64 Sample Code
65 </h4>
66 <div>
67 <pre>
68 #include &lt;<a href="../headers/cat.html">boost/preprocessor/cat.hpp</a>&gt;
69 #include &lt;<a href="../headers/seq/elem.html">boost/preprocessor/seq/elem.hpp</a>&gt;
70 #include &lt;<a href="../headers/seq/fold_right.html">boost/preprocessor/seq/fold_right.hpp</a>&gt;
71 #include &lt;<a href="../headers/seq/pop_back.html">boost/preprocessor/seq/pop_back.hpp</a>&gt;
72
73 #define SEQ (t)(s)(o)(o)(b)
74
75 #define OP(s, state, x) <a href="cat.html">BOOST_PP_CAT</a>(state, x)
76
77 <a href="seq_fold_right.html">BOOST_PP_SEQ_FOLD_RIGHT</a>(OP, <a href="seq_elem.html">BOOST_PP_SEQ_ELEM</a>(4, SEQ), <a href="seq_pop_back.html">BOOST_PP_SEQ_POP_BACK</a>(SEQ)) // expands to boost
78 </pre>
79 </div>
80 <hr size="1">
81 <div style="margin-left: 0px;">
82 <i>© Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
83 </br><i>© Copyright Paul Mensonides 2002</i>
84 </div>
85 <div style="margin-left: 0px;">
86 <p><small>Distributed under the Boost Software License, Version 1.0. (See
87 accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
88 copy at <a href=
89 "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
90 </div>
91 </body>
92 </html>