Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.



      typename Sequence
    , typename Op
struct transform
    typedef unspecified type;


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.


#include "boost/mpl/transform.hpp"


 Parameter  Requirement  Description  
SequenceA model of Extensible SequenceThe original sequence.
OpAn unary [Lambda Expression]A transformation.

Expression semantics

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


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


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;

See also

Algorithms, replace, replace_if, transform

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