Class template function_input_iterator

| Home | Libraries | People | FAQ | More

## Class template function_input_iterator

boost::compute::function_input_iterator — Iterator which returns the result of a function when dereferenced.

## Synopsis

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

    template<typename Function>
    class function_input_iterator {
    public:
      // types
      typedef unspecified                 super_type;
      typedef super_type::reference       reference;
      typedef super_type::difference_type difference_type;
      typedef Function                    function;

      // construct/copy/destruct
      function_input_iterator(const Function &, size_t = 0);
      function_input_iterator(const function_input_iterator< Function > &);
      function_input_iterator< Function > &
      operator=(const function_input_iterator< Function > &);
      ~function_input_iterator();

      // public member functions
      size_t get_index() const;
      template<typename Expr> unspecified operator[](const Expr &) const;

      // private member functions
      reference dereference() const;
      bool equal(const function_input_iterator< Function > &) const;
      void increment();
      void decrement();
      void advance(difference_type);
      difference_type
      distance_to(const function_input_iterator< Function > &) const;
    };

## Description

For example:

    BOOST_COMPUTE_FUNCTION(int, ret42, (),
    {
        return 42;
    });

    boost::compute::copy(
        boost::compute::make_function_input_iterator(ret42, 0),
        boost::compute::make_function_input_iterator(ret42, result.size()),
        result.begin(),
        queue
    );

    // result == { 42, 42, 42, 42 }

See Also:

make_function_input_iterator()

### `function_input_iterator` public construct/copy/destruct

1.     function_input_iterator(const Function & function, size_t index = 0);

2.     function_input_iterator(const function_input_iterator< Function > & other);

3.     function_input_iterator< Function > &
       operator=(const function_input_iterator< Function > & other);

4.     ~function_input_iterator();

### `function_input_iterator` public member functions

1.     size_t get_index() const;

2.     template<typename Expr> unspecified operator[](const Expr & expr) const;

### `function_input_iterator` private member functions

1.     reference dereference() const;

2.     bool equal(const function_input_iterator< Function > & other) const;

3.     void increment();

4.     void decrement();

5.     void advance(difference_type n);

6.     difference_type
       distance_to(const function_input_iterator< Function > & other) const;