3 <title>BOOST_PP_SEQ_FOLD_RIGHT
</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
</b> macro folds (or accumulates) the elements of
9 a
<i>seq
</i> right-to-left.
15 <b>BOOST_PP_SEQ_FOLD_RIGHT
</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_RIGHT
</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>2</i>),
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>.
55 <a href=
"seq_fold_right_s.html">BOOST_PP_SEQ_FOLD_RIGHT_
<i>s
</i></a></li>
61 <b>Header:
</b> <a href=
"../headers/seq/fold_right.html"><boost/preprocessor/seq/fold_right.hpp
></a>
68 #include
<<a href=
"../headers/cat.html">boost/preprocessor/cat.hpp
</a>>
69 #include
<<a href=
"../headers/seq/elem.html">boost/preprocessor/seq/elem.hpp
</a>>
70 #include
<<a href=
"../headers/seq/fold_right.html">boost/preprocessor/seq/fold_right.hpp
</a>>
71 #include
<<a href=
"../headers/seq/pop_back.html">boost/preprocessor/seq/pop_back.hpp
</a>>
73 #define SEQ (t)(s)(o)(o)(b)
75 #define OP(s, state, x)
<a href=
"cat.html">BOOST_PP_CAT
</a>(state, x)
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
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>
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
89 "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt
</a>)
</small></p>