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 to view this page for the latest version.
PrevUpHomeNext

Function template make_transform_iterator

boost::compute::make_transform_iterator

Synopsis

// In header: <boost/compute/iterator/transform_iterator.hpp>


template<typename InputIterator, typename UnaryFunction> 
  transform_iterator< InputIterator, UnaryFunction > 
  make_transform_iterator(InputIterator iterator, UnaryFunction transform);

Description

Returns a transform_iterator for iterator with transform.

For example, to create an iterator which returns the square-root of each value in a vector<int>:

auto sqrt_iterator = make_transform_iterator(vec.begin(), sqrt<int>());

Parameters:

iterator

the underlying iterator

transform

the unary transform function

Returns:

a transform_iterator for iterator with transform


PrevUpHomeNext