Template Struct pair

Struct Documentation

template<typename T1, typename T2>
struct pair

pair is a generic data structure encapsulating a heterogeneous pair of values.

Template Parameters
  • T1: The type of pair's first object type. There are no requirements on the type of T1. T1’s type is provided by pair::first_type.

  • T2: The type of pair's second object type. There are no requirements on the type of T2. T2’s type is provided by pair::second_type.

Public Types

typedef T1 first_type

first_type is the type of pair's first object type.

typedef T2 second_type

second_type is the type of pair's second object type.

Public Functions

__host__ __device__ thrust::pair::pair(void)

pair's default constructor constructs first and second using first_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 into first.

  • y: The object to copy into second.

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 this pair's first_type and second_type, respectively.

Parameters
  • p: The pair to copy from.

Template Parameters
  • U1: is convertible to first_type.

  • U2: is convertible to second_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 this pair's first_type and second_type, respectively.

Parameters
  • p: The std::pair to copy from.

Template Parameters
  • U1: is convertible to first_type.

  • U2: is convertible to second_type.

__host__ __device__ void thrust::pair::swap(pair & p)

swap swaps the elements of two pairs.

Parameters
  • p: The other pair with which to swap.

Public Members

first_type first

The pair's first object.

second_type second

The pair's second object.