...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::permutation_iterator — The permutation_iterator class provides a permuation iterator.
// 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; // public member functions permutation_iterator(ElementIterator, IndexIterator); permutation_iterator(const permutation_iterator< ElementIterator, IndexIterator > &); permutation_iterator< ElementIterator, IndexIterator > & operator=(const permutation_iterator< ElementIterator, IndexIterator > &); ~permutation_iterator(); size_t get_index() const; const buffer & get_buffer() const; template<typename IndexExpr> unspecified operator[](const IndexExpr &) const; // private member functions reference dereference() const; };
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 member functionspermutation_iterator(ElementIterator e, IndexIterator i);
permutation_iterator(const permutation_iterator< ElementIterator, IndexIterator > & other);
permutation_iterator< ElementIterator, IndexIterator > & operator=(const permutation_iterator< ElementIterator, IndexIterator > & other);
~permutation_iterator();
size_t get_index() const;
const buffer & get_buffer() const;
template<typename IndexExpr> unspecified operator[](const IndexExpr & expr) const;