Boost C++ Libraries

...one 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.

[Home]transform_view

Synopsis

template<
      typename Sequence
    , typename F
    >
struct transform_view
{
    // unspecified
};

Description

transform_view is a sequence wrapper that allows one to operate on the transformed sequence without actually creating one.

Definition

#include "boost/mpl/transform_view.hpp"

Parameters

 Parameter  Requirement  Description  
SequenceA model of SequenceA sequence to wrap.
FA model of unary [Lambda Expression]A transformation metafunction.

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef transform_view<Sequence,F> s;A model of Sequences is a sequence such that for each i in [begin<s>::type, end<s>::type) and for each j in [begin<Sequence>::type, end<Sequence>::type) i::type is identical to apply< lambda<F>::type, j::type >::type.size<Sequence>::type::value == size<s>::type::value.

Complexity

Amortized constant time.

Example

Finds the largest type in a sequence.

typedef list<int,long,char,char[50],double> types;
typedef max_element<
      transform_view< types, size_of<_> >
    >::type iter;
BOOST_STATIC_ASSERT(iter::type::value == 50);

See also

Sequences, filter_view, joint_view, zip_view, max_element


Table of Contents
Last edited March 10, 2003 4:43 am