3 <title>BOOST_PP_SEQ_FOLD_RIGHT_s
</title>
4 <link rel=
"stylesheet" type=
"text/css" href=
"../styles.css">
7 <div style=
"margin-left: 0px;">
8 The
<b>BOOST_PP_SEQ_FOLD_RIGHT_
<i>s
</i></b> macro folds (or accumulates) the
9 elements of a
<i>seq
</i> right-to-left.
It reenters
<b>BOOST_PP_SEQ_FOLD_RIGHT
</b>
10 with maximum efficiency.
16 <b>BOOST_PP_SEQ_FOLD_RIGHT_
</b> ##
<i>s
</i>(
<i>op
</i>,
<i>state
</i>,
<i>seq
</i>)
24 The next available
<b>BOOST_PP_SEQ_FOLD_LEFT
</b> fold step.
28 A ternary operation of the form
<i>op
</i>(
<i>s
</i>,
<i>state
</i>,
<i>elem
</i>).
29 This macro is called for each element in
<i>seq
</i>--each time returning a new
<i>state
</i>.
30 This operation is expanded by
<b>BOOST_PP_SEQ_FOLD_RIGHT
</b> with the next
31 available fold step, the current
<i>state
</i>, and the current element.
35 The initial state of the fold.
39 The
<i>seq
</i> to be folded.
46 For the
<i>seq
</i>, (
<i>0</i>)(
<i>1</i>)(
<i>2</i>), this macro expands to:
48 <i>op
</i>(
<i>s
</i>,
<i>op
</i>(
<i>s
</i>,
<i>op
</i>(
<i>s
</i>,
<i>state
</i>,
<i>2</i>),
57 <a href=
"seq_fold_right.html">BOOST_PP_SEQ_FOLD_RIGHT
</a></li>
63 <b>Header:
</b> <a href=
"../headers/seq/fold_right.html"><boost/preprocessor/seq/fold_right.hpp
></a>
70 #include
<<a href=
"../headers/cat.html">boost/preprocessor/cat.hpp
</a>>
71 #include
<<a href=
"../headers/seq/fold_left.html">boost/preprocessor/seq/fold_left.hpp
</a>>
72 #include
<<a href=
"../headers/seq/fold_right.html">boost/preprocessor/seq/fold_right.hpp
</a>>
73 #include
<<a href=
"../headers/seq/seq.html">boost/preprocessor/seq/seq.hpp
</a>>
76 #define S2 (S1)(S1)(S1)
78 #define OP(s, state, x) state (
<a href=
"seq_fold_left_s.html">BOOST_PP_SEQ_FOLD_RIGHT_
</a> ## s(OP_2, _, x))
79 #define OP_2(s, state, x)
<a href=
"cat.html">BOOST_PP_CAT
</a>(state, x)
81 <a href=
"seq_fold_left.html">BOOST_PP_SEQ_FOLD_LEFT
</a>(OP,
<a href=
"seq_nil.html">BOOST_PP_SEQ_NIL
</a>, S2)
82 // expands to (_cba)(_cba)(_cba)
86 <div style=
"margin-left: 0px;">
87 <i>© Copyright
<a href=
"http://www.housemarque.com" target=
"_top">Housemarque Oy
</a> 2002</i>
88 </br><i>© Copyright Paul Mensonides
2002</i>
90 <div style=
"margin-left: 0px;">
91 <p><small>Distributed under the Boost Software License, Version
1.0. (See
92 accompanying file
<a href=
"../../../../LICENSE_1_0.txt">LICENSE_1_0.txt
</a> or
94 "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt
</a>)
</small></p>