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

Class template transform_iterator

boost::compute::transform_iterator — A transform iterator adaptor.

Synopsis

// 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;
};

Description

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/destruct

  1. transform_iterator(InputIterator iterator, UnaryFunction transform);
  2. transform_iterator(const transform_iterator< InputIterator, UnaryFunction > & other);
  3. transform_iterator< InputIterator, UnaryFunction > & 
    operator=(const transform_iterator< InputIterator, UnaryFunction > & other);
  4. ~transform_iterator();

transform_iterator public member functions

  1. size_t get_index() const;
  2. const buffer & get_buffer() const;
  3. template<typename IndexExpression> 
      unspecified operator[](const IndexExpression & expr) const;

transform_iterator private member functions

  1. reference dereference() const;

PrevUpHomeNext