thrust
Public Member Functions | List of all members
thrust::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 > Class Template Reference

#include <thrust/tuple.h>

Inherits type< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >.

Public Member Functions

__host__ __device__ tuple (void)
 
__host__ __device__ tuple (typename access_traits< T0 >::parameter_type t0)
 
__host__ __device__ tuple (typename access_traits< T0 >::parameter_type t0, typename access_traits< T1 >::parameter_type t1)
 
template<class U1 , class U2 >
__thrust_exec_check_disable__ __host__ __device__ tupleoperator= (const thrust::pair< U1, U2 > &k)
 
__host__ __device__ void swap (tuple &t)
 

Detailed Description

template<class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9>
class thrust::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >

tuple is a class template that can be instantiated with up to ten arguments. Each template argument specifies the type of element in the tuple. Consequently, tuples are heterogeneous, fixed-size collections of values. An instantiation of tuple with two arguments is similar to an instantiation of pair with the same two arguments. Individual elements of a tuple may be accessed with the get function.

Template Parameters
TNThe type of the N tuple element. Thrust's tuple type currently supports up to ten elements.

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>
...
// 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
get
make_tuple
tuple_element
tuple_size
tie

The documentation for this class was generated from the following file: