Kokkos Core Kernels Package
Version of the Day
|
Replacement for std::pair that works on CUDA devices. More...
#include <Kokkos_Pair.hpp>
Public Types | |
using | first_type = T1 |
The first template parameter of this class. More... | |
using | second_type = T2 |
The second template parameter of this class. More... | |
Public Member Functions | |
KOKKOS_DEFAULTED_FUNCTION constexpr | pair ()=default |
Default constructor. More... | |
KOKKOS_FORCEINLINE_FUNCTION constexpr | pair (first_type const &f, second_type const &s) |
Constructor that takes both elements of the pair. More... | |
template<class U , class V > | |
KOKKOS_FORCEINLINE_FUNCTION constexpr | pair (const pair< U, V > &p) |
Copy constructor. More... | |
template<class U , class V > | |
KOKKOS_FORCEINLINE_FUNCTION pair< T1, T2 > & | operator= (const pair< U, V > &p) |
Assignment operator. More... | |
std::pair< T1, T2 > | to_std_pair () const |
Return the std::pair version of this object. More... | |
Public Attributes | |
first_type | first |
The first element of the pair. More... | |
second_type | second |
The second element of the pair. More... | |
Replacement for std::pair that works on CUDA devices.
The instance methods of std::pair, including its constructors, are not marked as __device__
functions. Thus, they cannot be called on a CUDA device, such as an NVIDIA GPU. This struct implements the same interface as std::pair, but can be used on a CUDA device as well as on the host.
Definition at line 43 of file Kokkos_Pair.hpp.
using Kokkos::pair< T1, T2 >::first_type = T1 |
The first template parameter of this class.
Definition at line 45 of file Kokkos_Pair.hpp.
using Kokkos::pair< T1, T2 >::second_type = T2 |
The second template parameter of this class.
Definition at line 47 of file Kokkos_Pair.hpp.
|
default |
Default constructor.
This calls the default constructors of T1 and T2. It won't compile if those default constructors are not defined and public.
|
inline |
Constructor that takes both elements of the pair.
This calls the copy constructors of T1 and T2. It won't compile if those copy constructors are not defined and public.
Definition at line 70 of file Kokkos_Pair.hpp.
|
inline |
Copy constructor.
This calls the copy constructors of T1 and T2. It won't compile if those copy constructors are not defined and public.
Definition at line 82 of file Kokkos_Pair.hpp.
|
inline |
Assignment operator.
This calls the assignment operators of T1 and T2. It won't compile if the assignment operators are not defined and public.
Definition at line 102 of file Kokkos_Pair.hpp.
|
inline |
Return the std::pair version of this object.
This is not a device function; you may not call it on a CUDA device. It is meant to be called on the host, if the user wants an std::pair instead of a Kokkos::pair.
Definition at line 143 of file Kokkos_Pair.hpp.
first_type Kokkos::pair< T1, T2 >::first |
The first element of the pair.
Definition at line 50 of file Kokkos_Pair.hpp.
second_type Kokkos::pair< T1, T2 >::second |
The second element of the pair.
Definition at line 52 of file Kokkos_Pair.hpp.