...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::compute::transform_iterator — A transform iterator adaptor.
// In header: <boost/compute/iterator/transform_iterator.hpp> template<typename InputIterator, typename UnaryFunction> class transform_iterator { public: // types typedef unspecified super_type; typedef super_type::value_type value_type; typedef super_type::reference reference; typedef super_type::base_type base_type; typedef super_type::difference_type difference_type; typedef UnaryFunction unary_function; // construct/copy/destruct transform_iterator(InputIterator, UnaryFunction); transform_iterator(const transform_iterator< InputIterator, UnaryFunction > &); transform_iterator< InputIterator, UnaryFunction > & operator=(const transform_iterator< InputIterator, UnaryFunction > &); ~transform_iterator(); // public member functions size_t get_index() const; const buffer & get_buffer() const; template<typename IndexExpression> unspecified operator[](const IndexExpression &) const; // private member functions reference dereference() const; };
The transform_iterator adaptor applies a unary function to each element produced from the underlying iterator when dereferenced.
For example, to copy from an input range to an output range while taking the absolute value of each element:
See Also:
buffer_iterator, make_transform_iterator()
transform_iterator
public
construct/copy/destructtransform_iterator(InputIterator iterator, UnaryFunction transform);
transform_iterator(const transform_iterator< InputIterator, UnaryFunction > & other);
transform_iterator< InputIterator, UnaryFunction > & operator=(const transform_iterator< InputIterator, UnaryFunction > & other);
~transform_iterator();