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