Kokkos Core Kernels Package
Version of the Day
|
Declaration and definition of Kokkos::pair. More...
#include <Kokkos_Macros.hpp>
#include <utility>
Go to the source code of this file.
Classes | |
struct | Kokkos::pair< T1, T2 > |
Replacement for std::pair that works on CUDA devices. More... | |
Functions | |
template<class T1 , class T2 > | |
KOKKOS_FORCEINLINE_FUNCTION bool | Kokkos::operator== (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
Equality operator for Kokkos::pair. More... | |
template<class T1 , class T2 > | |
KOKKOS_FORCEINLINE_FUNCTION constexpr bool | Kokkos::operator!= (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
Inequality operator for Kokkos::pair. More... | |
template<class T1 , class T2 > | |
KOKKOS_FORCEINLINE_FUNCTION constexpr bool | Kokkos::operator< (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
Less-than operator for Kokkos::pair. More... | |
template<class T1 , class T2 > | |
KOKKOS_FORCEINLINE_FUNCTION constexpr bool | Kokkos::operator<= (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
Less-than-or-equal-to operator for Kokkos::pair. More... | |
template<class T1 , class T2 > | |
KOKKOS_FORCEINLINE_FUNCTION constexpr bool | Kokkos::operator> (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
Greater-than operator for Kokkos::pair. More... | |
template<class T1 , class T2 > | |
KOKKOS_FORCEINLINE_FUNCTION constexpr bool | Kokkos::operator>= (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
Greater-than-or-equal-to operator for Kokkos::pair. More... | |
template<class T1 , class T2 > | |
KOKKOS_FORCEINLINE_FUNCTION constexpr pair< T1, T2 > | Kokkos::make_pair (T1 x, T2 y) |
Return a new pair. More... | |
template<class T1 , class T2 > | |
KOKKOS_FORCEINLINE_FUNCTION pair< T1 &, T2 & > | Kokkos::tie (T1 &x, T2 &y) |
Return a pair of references to the input arguments. More... | |
Declaration and definition of Kokkos::pair.
This header file declares and defines Kokkos::pair and its related nonmember functions.
Definition in file Kokkos_Pair.hpp.
KOKKOS_FORCEINLINE_FUNCTION bool Kokkos::operator== | ( | const pair< T1, T2 > & | lhs, |
const pair< T1, T2 > & | rhs | ||
) |
Equality operator for Kokkos::pair.
Definition at line 329 of file Kokkos_Pair.hpp.
KOKKOS_FORCEINLINE_FUNCTION constexpr bool Kokkos::operator!= | ( | const pair< T1, T2 > & | lhs, |
const pair< T1, T2 > & | rhs | ||
) |
Inequality operator for Kokkos::pair.
Definition at line 336 of file Kokkos_Pair.hpp.
KOKKOS_FORCEINLINE_FUNCTION constexpr bool Kokkos::operator< | ( | const pair< T1, T2 > & | lhs, |
const pair< T1, T2 > & | rhs | ||
) |
Less-than operator for Kokkos::pair.
Definition at line 343 of file Kokkos_Pair.hpp.
KOKKOS_FORCEINLINE_FUNCTION constexpr bool Kokkos::operator<= | ( | const pair< T1, T2 > & | lhs, |
const pair< T1, T2 > & | rhs | ||
) |
Less-than-or-equal-to operator for Kokkos::pair.
Definition at line 351 of file Kokkos_Pair.hpp.
KOKKOS_FORCEINLINE_FUNCTION constexpr bool Kokkos::operator> | ( | const pair< T1, T2 > & | lhs, |
const pair< T1, T2 > & | rhs | ||
) |
Greater-than operator for Kokkos::pair.
Definition at line 358 of file Kokkos_Pair.hpp.
KOKKOS_FORCEINLINE_FUNCTION constexpr bool Kokkos::operator>= | ( | const pair< T1, T2 > & | lhs, |
const pair< T1, T2 > & | rhs | ||
) |
Greater-than-or-equal-to operator for Kokkos::pair.
Definition at line 365 of file Kokkos_Pair.hpp.
KOKKOS_FORCEINLINE_FUNCTION constexpr pair<T1, T2> Kokkos::make_pair | ( | T1 | x, |
T2 | y | ||
) |
Return a new pair.
This is a "nonmember constructor" for Kokkos::pair. It works just like std::make_pair.
Definition at line 375 of file Kokkos_Pair.hpp.
KOKKOS_FORCEINLINE_FUNCTION pair<T1&, T2&> Kokkos::tie | ( | T1 & | x, |
T2 & | y | ||
) |
Return a pair of references to the input arguments.
This compares to std::tie (new in C++11). You can use it to assign to two variables at once, from the result of a function that returns a pair. For example (__device__
and __host__
attributes omitted for brevity):
The line that uses tie() could have been written like this:
Using tie() saves two lines of code and avoids a copy of each element of the pair. The latter could be significant if one or both elements of the pair are more substantial objects than int
or bool
.
Definition at line 419 of file Kokkos_Pair.hpp.