A random-access input wrapper for pairing dereferenced values with their corresponding indices (forming KeyValuePair tuples).
More...
template<typename InputIteratorT, typename OffsetT = ptrdiff_t, typename OutputValueT = typename std::iterator_traits<InputIteratorT>::value_type>
class cub::ArgIndexInputIterator< InputIteratorT, OffsetT, OutputValueT >
A random-access input wrapper for pairing dereferenced values with their corresponding indices (forming KeyValuePair tuples).
- Overview
- ArgIndexInputIteratorTwraps a random access input iterator
itr of type InputIteratorT. Dereferencing an ArgIndexInputIteratorTat offset i produces a KeyValuePair value whose key field is i and whose value field is itr[i].
- Can be used with any data type.
- Can be constructed, manipulated, and exchanged within and between host and device functions. Wrapped host memory can only be dereferenced on the host, and wrapped device memory can only be dereferenced on the device.
- Compatible with Thrust API v1.7 or newer.
- Snippet
- The code snippet below illustrates the use of
ArgIndexInputIteratorTto dereference an array of doubles
#include <cub/cub.cuh>
double *d_in;
Tuple item_offset_pair.
key = *itr;
printf("%f @ %d\n",
item_offset_pair.value,
item_offset_pair.key);
itr = itr + 6;
item_offset_pair.key = *itr;
printf("%f @ %d\n",
item_offset_pair.value,
item_offset_pair.key);
A key identifier paired with a corresponding value.
- Template Parameters
-
| InputIteratorT | The value type of the wrapped input iterator |
| OffsetT | The difference type of this iterator (Default: ptrdiff_t) |
| OutputValueT | The paired value type of the <offset,value> tuple (Default: value type of input iterator) |
Definition at line 113 of file arg_index_input_iterator.cuh.
◆ ArgIndexInputIterator()
template<typename InputIteratorT , typename OffsetT = ptrdiff_t, typename OutputValueT = typename std::iterator_traits<InputIteratorT>::value_type>
Constructor.
- Parameters
-
| itr | Input iterator to wrap |
| offset | OffsetT (in items) from itr denoting the position of the iterator |
Definition at line 144 of file arg_index_input_iterator.cuh.
The documentation for this class was generated from the following file: