thrust

◆ get() [2/2]

template<int N, class HT , class TT >
__host__ __device__ access_traits< typename tuple_element<N, detail::cons<HT, TT> >::type >::const_type thrust::get ( const detail::cons< HT, TT > &  t)
inline

The get function returns a const reference to a tuple element of interest.

Parameters
tA reference to a tuple of interest.
Returns
A const reference to t's Nth element.
Template Parameters
NThe index of the element of interest.

The following code snippet demonstrates how to use get to print the value of a tuple element.

#include <thrust/tuple.h>
#include <iostream>
...
thrust::tuple<int, const char *> t(13, "thrust");
std::cout << "The 1st value of t is " << thrust::get<0>(t) << std::endl;
See also
pair
tuple