| Home | Libraries | People | FAQ | More

## 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;

      // public member functions
      transform_iterator(InputIterator, UnaryFunction);
      transform_iterator(const transform_iterator< InputIterator, UnaryFunction > &);
      transform_iterator< InputIterator, UnaryFunction > &
      operator=(const transform_iterator< InputIterator, UnaryFunction > &);
      ~transform_iterator();
      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 member functions

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();

5.     size_t get_index() const;

6.     const buffer & get_buffer() const;

7.     template<typename IndexExpression>
         unspecified operator[](const IndexExpression & expr) const;

### `transform_iterator` private member functions

1.     reference dereference() const;