3 <title>BOOST_PP_SEQ_FOLD_LEFT
</title>
4 <link rel=
"stylesheet" type=
"text/css" href=
"../styles.css">
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.
15 <b>BOOST_PP_SEQ_FOLD_LEFT
</b>(
<i>op
</i>,
<i>state
</i>,
<i>seq
</i>)
23 A ternary operation of the form
<i>op
</i>(
<i>s
</i>,
<i>state
</i>,
<i>elem
</i>).
24 This macro is called for each element in
<i>seq
</i>--each time returning a new
<i>state
</i>.
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.
30 The initial state of the fold.
34 The
<i>seq
</i> to be folded.
41 For the
<i>seq
</i>, (
<i>0</i>)(
<i>1</i>)(
<i>2</i>), this macro expands to:
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>),
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>.
55 <a href=
"seq_fold_left_s.html">BOOST_PP_SEQ_FOLD_LEFT_
<i>s
</i></a></li>
61 <b>Header:
</b> <a href=
"../headers/seq/fold_left.html"><boost/preprocessor/seq/fold_left.hpp
></a>
68 #include
<<a href=
"../headers/cat.html">boost/preprocessor/cat.hpp
</a>>
69 #include
<<a href=
"../headers/seq/fold_left.html">boost/preprocessor/seq/fold_left.hpp
</a>>
71 #define SEQ (b)(o)(o)(s)(t)
73 #define OP(s, state, x)
<a href=
"cat.html">BOOST_PP_CAT
</a>(state, x)
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
79 <div style=
"margin-left: 0px;">
80 <i>© Copyright
<a href=
"http://www.housemarque.com" target=
"_top">Housemarque Oy
</a> 2002</i>
81 </br><i>© Copyright Paul Mensonides
2002</i>
83 <div style=
"margin-left: 0px;">
84 <p><small>Distributed under the Boost Software License, Version
1.0. (See
85 accompanying file
<a href=
"../../../../LICENSE_1_0.txt">LICENSE_1_0.txt
</a> or
87 "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt
</a>)
</small></p>