thrust
Classes | Functions
Tuple

Classes

struct  thrust::tuple_element< N, T >
 
struct  thrust::tuple_size< Pair >
 
class  thrust::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >
 

Functions

template<int N, class HT , class TT >
__host__ __device__
access_traits< typename
tuple_element< N, detail::cons
< HT, TT > >::type >
::non_const_type 
thrust::get (detail::cons< HT, TT > &t)
 
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)
 
template<class T0 >
__host__ __device__
detail::make_tuple_mapper< T0 >
::type 
thrust::make_tuple (const T0 &t0)
 
template<class T0 , class T1 >
__host__ __device__
detail::make_tuple_mapper< T0,
T1 >::type 
thrust::make_tuple (const T0 &t0, const T1 &t1)
 
template<typename T0 >
__host__ __device__ tuple< T0 & > thrust::tie (T0 &t0)
 
template<typename T0 , typename T1 >
__host__ __device__ tuple< T0
&, T1 & > 
thrust::tie (T0 &t0, T1 &t1)
 
template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 >
__host__ __device__ void thrust::swap (tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 > &x, tuple< U0, U1, U2, U3, U4, U5, U6, U7, U8, U9 > &y)
 

Detailed Description

Function Documentation

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

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

Parameters
tA reference to a tuple of interest.
Returns
A 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
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
template<class T0 >
__host__ __device__ detail::make_tuple_mapper<T0>::type thrust::make_tuple ( const T0 &  t0)
inline

This version of make_tuple creates a new tuple object from a single object.

Parameters
t0The object to copy from.
Returns
A tuple object with a single member which is a copy of t0.
template<class T0 , class T1 >
__host__ __device__ detail::make_tuple_mapper<T0, T1>::type thrust::make_tuple ( const T0 &  t0,
const T1 &  t1 
)
inline

This version of make_tuple creates a new tuple object from two objects.

Parameters
t0The first object to copy from.
t1The second object to copy from.
Returns
A tuple object with two members which are copies of t0 and t1.
Note
make_tuple has ten variants, the rest of which are omitted here for brevity.
template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 >
__host__ __device__ void thrust::swap ( tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 > &  x,
tuple< U0, U1, U2, U3, U4, U5, U6, U7, U8, U9 > &  y 
)
inline

swap swaps the contents of two tuples.

Parameters
xThe first tuple to swap.
yThe second tuple to swap.

Referenced by thrust::tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::swap().

template<typename T0 >
__host__ __device__ tuple<T0&> thrust::tie ( T0 &  t0)
inline

This version of tie creates a new tuple whose single element is a reference which refers to this function's argument.

Parameters
t0The object to reference.
Returns
A tuple object with one member which is a reference to t0.
template<typename T0 , typename T1 >
__host__ __device__ tuple<T0&,T1&> thrust::tie ( T0 &  t0,
T1 &  t1 
)
inline

This version of tie creates a new tuple of references object which refers to this function's arguments.

Parameters
t0The first object to reference.
t1The second object to reference.
Returns
A tuple object with two members which are references to t0 and t1.
Note
tie has ten variants, the rest of which are omitted here for brevity.