Template Struct pair¶
Defined in File pair.h
Struct Documentation¶
-
template<typename
T1
, typenameT2
>
structpair
¶ pair
is a generic data structure encapsulating a heterogeneous pair of values.- Template Parameters
T1
: The type ofpair's
first object type. There are no requirements on the type ofT1
.T1
’s type is provided bypair::first_type
.T2
: The type ofpair's
second object type. There are no requirements on the type ofT2
.T2
’s type is provided bypair::second_type
.
Public Types
-
typedef T1
first_type
¶ first_type
is the type ofpair's
first object type.
-
typedef T2
second_type
¶ second_type
is the type ofpair's
second object type.
Public Functions
-
__host__ __device__ thrust::pair::pair(void)
pair's
default constructor constructsfirst
andsecond
usingfirst_type
&second_type's
default constructors, respectively.
-
__host__ __device__ thrust::pair::pair(const T1 & x, const T2 & y)
This constructor accepts two objects to copy into this
pair
.- Parameters
x
: The object to copy intofirst
.y
: The object to copy intosecond
.
-
template<typename U1, typename U2>__host__ __device__ thrust::pair::pair(const pair < U1, U2 > & p)
This copy constructor copies from a
pair
whose types are convertible to thispair's
first_type
andsecond_type
, respectively.- Parameters
p
: Thepair
to copy from.
- Template Parameters
U1
: is convertible tofirst_type
.U2
: is convertible tosecond_type
.
-
template<typename U1, typename U2>__host__ __device__ thrust::pair::pair(const std::pair< U1, U2 > & p)
This copy constructor copies from a
std::pair
whose types are convertible to thispair's
first_type
andsecond_type
, respectively.- Parameters
p
: Thestd::pair
to copy from.
- Template Parameters
U1
: is convertible tofirst_type
.U2
: is convertible tosecond_type
.
-
__host__ __device__ void thrust::pair::swap(pair & p)
swap
swaps the elements of twopair
s.- Parameters
p
: The otherpair
with which to swap.
Public Members
-
first_type
first
¶ The
pair's
first object.
-
second_type
second
¶ The
pair's
second object.