Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world.

 |  |  | Full TOC Front Page / Algorithms / Transformation Algorithms / reverse_transform

reverse_transform

Synopsis

```template<
typename Seq
, typename Op
, typename In = unspecified
>
struct reverse_transform
{
typedef unspecified type;
};

template<
typename Seq1
, typename Seq2
, typename BinaryOp
, typename In = unspecified
>
struct reverse_transform
{
typedef unspecified type;
};
```

Description

• reverse_transform<Seq,Op> returns a reversed, transformed copy of the original sequence produced by applying an unary transformation Op to every element in the [begin<Sequence>::type, end<Sequence>::type) range.
• reverse_transform<Seq1,Seq2,Op> returns a new sequence produced by applying a binary transformation BinaryOp to a pair of elements (e1, e21) from the corresponding [begin<Seq1>::type, end<Seq1>::type) and [begin<Seq2>::type, end<Seq2>::type) ranges in reverse order.

[Note: This wording applies to a no-inserter version(s) of the algorithm. See the Expression semantics subsection for a precise specification of the algorithm's details in all cases — end note]

```#include <boost/mpl/transform.hpp>
```

Model of

Reversible Algorithm

Parameters

Parameter Requirement Description
Sequence, Seq1, Seq2 Forward Sequence Sequences to transform.
Op, BinaryOp Lambda Expression A transformation.
In Inserter An inserter.

Expression semantics

The semantics of an expression are defined only where they differ from, or are not defined in Reversible Algorithm.

For any Forward Sequences s, s1 and s2, Lambda Expressions op and op2, and an Inserter in:

```typedef reverse_transform<s,op,in>::type r;
```
Return type: A type. Equivalent to ```typedef lambda::type f; typedef lambda::type in_op; typedef reverse_fold< s , in::state , bind< in_op, _1, bind > >::type r; ```
```typedef transform<s1,s2,op,in>::type r;
```
Return type: A type. Equivalent to ```typedef lambda::type f; typedef lambda::type in_op; typedef reverse_fold< pair_view , in::state , bind< in_op , _1 , bind,_2>, bind,_2> > > >::type r; ```

Complexity

Linear. Exactly size<s>::value / size<s1>::value applications of op / op2 and in::operation.

Example

```typedef vector<char,short,int,long,float,double> types;
typedef vector<double*,float*,long*,int*,short*,char*> pointers;