3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/reverse-iter-fold.html
| Prev Next | Back Along | Up Home | Full TOC | Front Page / Algorithms / Iteration Algorithms / reverse_iter_fold |
template<
typename Sequence
, typename State
, typename BackwardOp
, typename ForwardOp =[\_1](./placeholders.html)>
struct[reverse\_iter\_fold](./reverse-iter-fold.html){
typedef_unspecified_type;
};
Returns the result of the successive application of binary BackwardOp to the result of the previous BackwardOp invocation (State if it's the first call) and each iterator in the range [begin<Sequence>::type, end<Sequence>::type) in reverse order. If ForwardOp is provided, then it's applied on forward traversal to form the result which is passed to the first BackwardOp call.
#include <[boost/mpl/reverse\_iter\_fold.hpp](../../../../boost/mpl/reverse_iter_fold.hpp)>
| Parameter | Requirement | Description |
|---|---|---|
| Sequence | Forward Sequence | A sequence to iterate. |
| State | Any type | The initial state for the first BackwardOp / ForwardOp application. |
| BackwardOp | Binary Lambda Expression | The operation to be executed on backward traversal. |
| ForwardOp | Binary Lambda Expression | The operation to be executed on forward traversal. |
For any Forward Sequence s, binary Lambda Expression backward_op and forward_op, and arbitrary type state:
typedef[reverse\_iter\_fold](./reverse-iter-fold.html)< s,state,backward_op >::type t;
| Return type: |
A type.
| | Semantics: |
Equivalent to
typedef[begin](./begin.html)<s>::type i1;
typedef[next](./next.html)<i1>::type i2;_..._typedef[next](./next.html)<in>::type last;
typedef[apply](./apply.html)<backward_op,state,in>::type staten;
typedef[apply](./apply.html)<backward_op,staten,in-1>::type staten-1;_..._typedef[apply](./apply.html)<backward_op,state2,i1>::type state1;
typedef state1t;
where n == size<s>::value and last is identical to end<s>::type; equivalent to typedef state t; if empty<s>::value == true.
|
typedef[reverse\_iter\_fold](./reverse-iter-fold.html)< s,state,backward_op,forward_op >::type t;
| Return type: |
A type.
| | Semantics: |
Equivalent to
typedef[reverse\_iter\_fold](./reverse-iter-fold.html)<
Sequence
,[iter\_fold](./iter-fold.html)<s,state,forward_op>::type
, backward_op
>::type t;
|
Linear. Exactly size<s>::value applications of backward_op and forward_op.
Build a list of iterators to the negative elements in a sequence.
typedef[vector\_c](./vector-c.html)<int,5,-1,0,-7,-2,0,-5,4> numbers;
typedef[list\_c](./list-c.html)<int,-1,-7,-2,-5> negatives;
typedef[reverse\_iter\_fold](./reverse-iter-fold.html)<
numbers
,[list](./list.html)<>
,[if\_](./if.html)<[less](./less.html)<[deref](./deref.html)<[\_2](./placeholders.html)>,[int\_](./int.html)<0> >,[push\_front](./push-front.html)<[\_1](./placeholders.html),[\_2](./placeholders.html)>,[\_1](./placeholders.html)>
>::type iters;[BOOST\_MPL\_ASSERT](./assert.html)(([equal](./equal.html)<
negatives
,[transform\_view](./transform-view.html)< iters,[deref](./deref.html)<[\_1](./placeholders.html)> >
> ));
Algorithms, iter_fold, reverse_fold, fold
| Prev Next | Back Along | Up Home | Full TOC |
Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |