# transform

### Synopsis

    template<
          typename Sequence
        , typename Op
        >
    struct transform
    {
        typedef unspecified type;
    };

### Description

Performs a transformation on the sequence. The algorithm returns a new sequence produced by applying the unary metafunction `Op` to every element in the `[begin<Sequence>::type, end<Sequence>::type)` range. The result sequence preserves all the functional and performance characteristics of the original `Sequence`, including its size, but not identity.

### Definition

    #include "boost/mpl/transform.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`Sequence` | A model of Extensible Sequence | The original sequence.
`Op` | An unary [Lambda Expression] | A transformation.

### Expression semantics

Expression | Expression type | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typedef transform<Sequence,Op>::type s;` | A model of Extensible Sequence |  |  | `size<s>::type::value == size<Sequence>::type::value`.

### Complexity

Linear. The operation `Op` is applied exactly `size<Sequence>::type::value` times.

### Example

    typedef list<char,short,int,long,float,double> types;
    typedef list<char*,short*,int*,long*,float*,double*> pointers;
    typedef transform< types,boost::add_pointer<_1> >::type result;
    BOOST_STATIC_ASSERT((equal<result,pointers>::value));

### See also

Algorithms, `replace`, `replace_if`, `transform`

Table of Contents
Last edited July 17, 2002 5:47 am