rocPRIM
Public Types | Public Member Functions | Friends | List of all members
arg_index_iterator< InputIterator, Difference, InputValueType > Class Template Reference

A random-access input (read-only) iterator adaptor for pairing dereferenced values with their indices. More...

#include <arg_index_iterator.hpp>

Public Types

using value_type = ::rocprim::key_value_pair< Difference, InputValueType >
 The type of the value that can be obtained by dereferencing the iterator.
 
using reference = const value_type &
 A reference type of the type iterated over (value_type). More...
 
using pointer = const value_type *
 A pointer type of the type iterated over (value_type). More...
 
using difference_type = Difference
 A type used for identify distance between iterators.
 
using iterator_category = std::random_access_iterator_tag
 The category of the iterator.
 
using self_type = arg_index_iterator
 

Public Member Functions

ROCPRIM_HOST_DEVICE arg_index_iterator (InputIterator iterator, difference_type offset=0)
 Creates a new arg_index_iterator. More...
 
ROCPRIM_HOST_DEVICE arg_index_iteratoroperator++ ()
 
ROCPRIM_HOST_DEVICE arg_index_iterator operator++ (int)
 
ROCPRIM_HOST_DEVICE value_type operator* () const
 
ROCPRIM_HOST_DEVICE pointer operator-> () const
 
ROCPRIM_HOST_DEVICE arg_index_iterator operator+ (difference_type distance) const
 
ROCPRIM_HOST_DEVICE arg_index_iteratoroperator+= (difference_type distance)
 
ROCPRIM_HOST_DEVICE arg_index_iterator operator- (difference_type distance) const
 
ROCPRIM_HOST_DEVICE arg_index_iteratoroperator-= (difference_type distance)
 
ROCPRIM_HOST_DEVICE difference_type operator- (arg_index_iterator other) const
 
ROCPRIM_HOST_DEVICE value_type operator[] (difference_type distance) const
 
ROCPRIM_HOST_DEVICE bool operator== (arg_index_iterator other) const
 
ROCPRIM_HOST_DEVICE bool operator!= (arg_index_iterator other) const
 
ROCPRIM_HOST_DEVICE bool operator< (arg_index_iterator other) const
 
ROCPRIM_HOST_DEVICE bool operator<= (arg_index_iterator other) const
 
ROCPRIM_HOST_DEVICE bool operator> (arg_index_iterator other) const
 
ROCPRIM_HOST_DEVICE bool operator>= (arg_index_iterator other) const
 
ROCPRIM_HOST_DEVICE void normalize ()
 

Friends

std::ostream & operator<< (std::ostream &os, const arg_index_iterator &)
 

Detailed Description

template<class InputIterator, class Difference = std::ptrdiff_t, class InputValueType = typename std::iterator_traits<InputIterator>::value_type>
class arg_index_iterator< InputIterator, Difference, InputValueType >

A random-access input (read-only) iterator adaptor for pairing dereferenced values with their indices.

Overview
  • Dereferencing arg_index_iterator return a value of key_value_pair<Difference, InputValueType> type, which includes value from the underlying range and its index in that range.
  • std::iterator_traits<InputIterator>::value_type should be convertible to InputValueType.
Template Parameters
InputIterator- type of the underlying random-access input iterator. Must be a random-access iterator.
Difference- type used for identify distance between iterators and as the index type in the output pair type (see value_type).
InputValueType- value type used in the output pair type (see value_type).

Member Typedef Documentation

◆ pointer

template<class InputIterator, class Difference = std::ptrdiff_t, class InputValueType = typename std::iterator_traits<InputIterator>::value_type>
using arg_index_iterator< InputIterator, Difference, InputValueType >::pointer = const value_type*

A pointer type of the type iterated over (value_type).

It's const since arg_index_iterator is a read-only iterator.

◆ reference

template<class InputIterator, class Difference = std::ptrdiff_t, class InputValueType = typename std::iterator_traits<InputIterator>::value_type>
using arg_index_iterator< InputIterator, Difference, InputValueType >::reference = const value_type&

A reference type of the type iterated over (value_type).

It's const since arg_index_iterator is a read-only iterator.

Constructor & Destructor Documentation

◆ arg_index_iterator()

template<class InputIterator, class Difference = std::ptrdiff_t, class InputValueType = typename std::iterator_traits<InputIterator>::value_type>
ROCPRIM_HOST_DEVICE arg_index_iterator< InputIterator, Difference, InputValueType >::arg_index_iterator ( InputIterator  iterator,
difference_type  offset = 0 
)
inline

Creates a new arg_index_iterator.

Parameters
iteratorinput iterator pointing to the input range.
offsetindex of the iterator in the input range.

The documentation for this class was generated from the following file: