]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/preprocessor/doc/ref/seq_fold_left.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / preprocessor / doc / ref / seq_fold_left.html
CommitLineData
7c673cae
FG
1<html>
2 <head>
3 <title>BOOST_PP_SEQ_FOLD_LEFT</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</b> macro folds (or accumulates) the elements of
9 a <i>seq</i> left-to-right.
10 </div>
11 <h4>
12 Usage
13 </h4>
14 <div class="code">
15 <b>BOOST_PP_SEQ_FOLD_LEFT</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_LEFT</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>0</i>),
44 <i>1</i>), <i>2</i>)
45 </div>
46 </div>
47 <div>
48 For maximum efficiency, <b>BOOST_PP_SEQ_FOLD_LEFT</b> can be reentered with <b>BOOST_PP_SEQ_FOLD_LEFT_<i>s</i></b>.
49 </div>
50 <h4>
51 See Also
52 </h4>
53 <ul>
54 <li>
55 <a href="seq_fold_left_s.html">BOOST_PP_SEQ_FOLD_LEFT_<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_left.html">&lt;boost/preprocessor/seq/fold_left.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/fold_left.html">boost/preprocessor/seq/fold_left.hpp</a>&gt;
70
71#define SEQ (b)(o)(o)(s)(t)
72
73#define OP(s, state, x) <a href="cat.html">BOOST_PP_CAT</a>(state, x)
74
75<a href="seq_fold_left.html">BOOST_PP_SEQ_FOLD_LEFT</a>(OP, <a href="seq_head.html">BOOST_PP_SEQ_HEAD</a>(SEQ), <a href="seq_tail.html">BOOST_PP_SEQ_TAIL</a>(SEQ)) // expands to boost
76</pre>
77 </div>
78 <hr size="1">
79 <div style="margin-left: 0px;">
80