template<typename Tuple>
class cusp::join_iterator< Tuple >
RandomAccessIterator for access to array entries from two concatenated iterators.
- Template Parameters
-
Iterator1 | The iterator type used to encapsulate the first set of entries. |
Iterator2 | The iterator type used to encapsulate the second set of entries. |
Iterator3 | The iterator type used to order concatenated entries from two separate iterators. |
- Overview
join_iterator
is an iterator which represents a pointer into a concatenated range of entries from two underlying arrays. This iterator is useful for creating a single range of permuted entries from two different iterators.
- Example
- The following code snippet demonstrates how to create a
join_iterator
whose value_type
is int
and whose values are gather from a counting_iterator
and a constant_iterator
.
#include <thrust/sequence.h>
#include <iostream>
int main(void)
{
typedef typename CountingArray::iterator CountingIterator;
typedef typename ConstantArray::iterator ConstantIterator;
CountingArray a(4);
ConstantArray b(5, 10);
thrust::sequence(indices.begin(), indices.end());
JoinIterator iter(a.begin(), a.end(), b.begin(), b.end(), indices.begin());
std::cout << iter[0] << std::endl;
std::cout << iter[3] << std::endl;
std::cout << iter[4] << std::endl;
return 0;
}
Definition at line 141 of file join_iterator.h.
template<typename Tuple >
Subscript access to the data contained in this iterator.
- Parameters
-
n | The index of the element for which data should be accessed. |
- Returns
- Read/write reference to data.
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.
Definition at line 222 of file join_iterator.h.