thrust::tuple
Defined in thrust/tuple.h
-
template<class ...Ts>
using thrust::tuple = _CUDA_VSTD::tuple<T...> tupleis a heterogeneous, fixed-size collection of values. An instantiation oftuplewith two arguments is similar to an instantiation ofpairwith the same two arguments. Individual elements of atuplemay be accessed with thegetfunction.The following code snippet demonstrates how to create a new
tupleobject 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
Ntupleelement. Thrust’stupletype currently supports up to ten elements.