| Home | Libraries | People | FAQ | More

## Class template permutation_iterator

boost::compute::permutation_iterator — The permutation_iterator class provides a permuation iterator.

## Synopsis

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

    template<typename ElementIterator, typename IndexIterator>
    class permutation_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 IndexIterator               index_iterator;

      // construct/copy/destruct
      permutation_iterator(ElementIterator, IndexIterator);
      permutation_iterator(const permutation_iterator< ElementIterator, IndexIterator > &);
      permutation_iterator< ElementIterator, IndexIterator > &
      operator=(const permutation_iterator< ElementIterator, IndexIterator > &);
      ~permutation_iterator();

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

      // private member functions
      reference dereference() const;
    };

## Description

A permutation iterator iterates over a value range and an index range. When dereferenced, it returns the value from the value range using the current index from the index range.

For example, to reverse a range using the copy() algorithm and a permutation sequence:

See Also:

make_permutation_iterator()

### `permutation_iterator` public construct/copy/destruct

1.     permutation_iterator(ElementIterator e, IndexIterator i);

2.     permutation_iterator(const permutation_iterator< ElementIterator, IndexIterator > & other);

3.     permutation_iterator< ElementIterator, IndexIterator > &
       operator=(const permutation_iterator< ElementIterator, IndexIterator > & other);

4.     ~permutation_iterator();

### `permutation_iterator` public member functions

1.     size_t get_index() const;

2.     const buffer & get_buffer() const;

3.     template<typename IndexExpr>
         unspecified operator[](const IndexExpr & expr) const;

### `permutation_iterator` private member functions

1.     reference dereference() const;