|
Kokkos Core Kernels Package Version of the Day
|
Declaration and definition of Kokkos::pair. More...
#include <Kokkos_Macros.hpp>#include <Kokkos_Swap.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... | |
Namespaces | |
| namespace | Kokkos::Impl |
| ScopeGuard Some user scope issues have been identified with some Kokkos::finalize calls; ScopeGuard aims to correct these issues. | |
Functions | |
| template<class T1 , class T2 > | |
| KOKKOS_FORCEINLINE_FUNCTION constexpr bool | Kokkos::operator== (const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs) |
| Equality operator for Kokkos::pair. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| template<class T1 , class T2 > | |
| KOKKOS_FORCEINLINE_FUNCTION constexpr pair< T1, T2 > | Kokkos::make_pair (T1 x, T2 y) |
| Return a new pair. | |
| 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. | |
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.
|
constexpr |
Equality operator for Kokkos::pair.
Definition at line 322 of file Kokkos_Pair.hpp.
|
constexpr |
Inequality operator for Kokkos::pair.
Definition at line 329 of file Kokkos_Pair.hpp.
|
constexpr |
Less-than operator for Kokkos::pair.
Definition at line 336 of file Kokkos_Pair.hpp.
|
constexpr |
Less-than-or-equal-to operator for Kokkos::pair.
Definition at line 344 of file Kokkos_Pair.hpp.
|
constexpr |
Greater-than operator for Kokkos::pair.
Definition at line 351 of file Kokkos_Pair.hpp.
|
constexpr |
Greater-than-or-equal-to operator for Kokkos::pair.
Definition at line 358 of file Kokkos_Pair.hpp.
|
constexpr |
Return a new pair.
This is a "nonmember constructor" for Kokkos::pair. It works just like std::make_pair.
Definition at line 368 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 412 of file Kokkos_Pair.hpp.