Thrust
|
#include <thrust/iterator/zip_iterator.h>
Public Member Functions | |
__host__ __device__ | zip_iterator () |
__host__ __device__ | zip_iterator (IteratorTuple iterator_tuple) |
template<typename OtherIteratorTuple > | |
__host__ __device__ | zip_iterator (const zip_iterator< OtherIteratorTuple > &other, typename thrust::detail::enable_if_convertible< OtherIteratorTuple, IteratorTuple >::type *=0) |
__host__ __device__ const IteratorTuple & | get_iterator_tuple () const |
zip_iterator
is an iterator which represents a pointer into a range of tuples
whose elements are themselves taken from a tuple
of input iterators. This iterator is useful for creating a virtual array of structures while achieving the same performance and bandwidth as the structure of arrays idiom. zip_iterator
also facilitates kernel fusion by providing a convenient means of amortizing the execution of the same operation over multiple ranges.
The following code snippet demonstrates how to create a zip_iterator
which represents the result of "zipping" multiple ranges together.
Defining the type of a zip_iterator
can be complex. The next code example demonstrates how to use the make_zip_iterator
function with the make_tuple
function to avoid explicitly specifying the type of the zip_iterator
. This example shows how to use zip_iterator
to copy multiple ranges with a single call to thrust::copy
.