thrust::tuple
Defined in thrust/tuple.h
-
template<class ...Ts>
using thrust::tuple = _CUDA_VSTD::tuple<T...> tuple
is a heterogeneous, fixed-size collection of values. An instantiation oftuple
with two arguments is similar to an instantiation ofpair
with the same two arguments. Individual elements of atuple
may be accessed with theget
function.The following code snippet demonstrates how to create a new
tuple
object and inspect and modify the value of its elements.#include <thrust/tuple.h> #include <iostream> int main() { // Create a tuple containing an `int`, a `float`, and a string. thrust::tuple<int, float, const char*> t(13, 0.1f, "thrust"); // Individual members are accessed with the free function `get`. std::cout << "The first element's value is " << thrust::get<0>(t) << std::endl; // ... or the member function `get`. std::cout << "The second element's value is " << t.get<1>() << std::endl; // We can also modify elements with the same function. thrust::get<0>(t) += 10; }
See also
Pair
See also
get
See also
make_tuple
See also
tuple_element
See also
tuple_size
See also
tie
- Template Parameters
Ts – The type of the
N
tuple
element. Thrust’stuple
type currently supports up to ten elements.