23#ifndef KOKKOS_PAIR_HPP
24#define KOKKOS_PAIR_HPP
25#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
26#define KOKKOS_IMPL_PUBLIC_INCLUDE
27#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PAIR
30#include <Kokkos_Macros.hpp>
31#include <Kokkos_Swap.hpp>
43template <
class T1,
class T2>
60 KOKKOS_DEFAULTED_FUNCTION
constexpr pair() =
default;
66#if defined(KOKKOS_COMPILER_NVHPC) && KOKKOS_COMPILER_NVHPC < 230700
67 KOKKOS_FORCEINLINE_FUNCTION
69 KOKKOS_FORCEINLINE_FUNCTION
constexpr
77 template <
class U,
class V>
78#if defined(KOKKOS_COMPILER_NVHPC) && KOKKOS_COMPILER_NVHPC < 230700
79 KOKKOS_FORCEINLINE_FUNCTION
81 KOKKOS_FORCEINLINE_FUNCTION
constexpr
87#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
92 template <
class U,
class V>
93 KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
102 template <
class U,
class V>
109#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
121 template <
class U,
class V>
122 KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION
void operator=(
132 template <
class U,
class V>
149template <
class T1,
class T2>
150struct pair<T1&, T2&> {
152 using first_type = T1&;
154 using second_type = T2&;
165 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(first_type f, second_type s)
166 : first(f), second(s) {}
172 template <
class U,
class V>
173 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
const pair<U, V>& p)
174 : first(p.first), second(p.second) {}
177 template <
class U,
class V>
178 pair(
const std::pair<U, V>& p) : first(p.first), second(p.second) {}
184 template <
class U,
class V>
185 KOKKOS_FORCEINLINE_FUNCTION pair<first_type, second_type>& operator=(
186 const pair<U, V>& p) {
201 std::pair<T1, T2> to_std_pair()
const {
202 return std::make_pair(first, second);
206template <
class T1,
class T2>
207struct pair<T1, T2&> {
209 using first_type = T1;
211 using second_type = T2&;
222 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(first_type
const& f, second_type s)
223 : first(f), second(s) {}
229 template <
class U,
class V>
230 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
const pair<U, V>& p)
231 : first(p.first), second(p.second) {}
234 template <
class U,
class V>
235 pair(
const std::pair<U, V>& p) : first(p.first), second(p.second) {}
241 template <
class U,
class V>
242 KOKKOS_FORCEINLINE_FUNCTION pair<first_type, second_type>& operator=(
243 const pair<U, V>& p) {
258 std::pair<T1, T2> to_std_pair()
const {
259 return std::make_pair(first, second);
263template <
class T1,
class T2>
264struct pair<T1&, T2> {
266 using first_type = T1&;
268 using second_type = T2;
279 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(first_type f, second_type
const& s)
280 : first(f), second(s) {}
286 template <
class U,
class V>
287 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
const pair<U, V>& p)
288 : first(p.first), second(p.second) {}
291 template <
class U,
class V>
292 pair(
const std::pair<U, V>& p) : first(p.first), second(p.second) {}
298 template <
class U,
class V>
299 KOKKOS_FORCEINLINE_FUNCTION pair<first_type, second_type>& operator=(
300 const pair<U, V>& p) {
315 std::pair<T1, T2> to_std_pair()
const {
316 return std::make_pair(first, second);
321template <
class T1,
class T2>
324 return lhs.first ==
rhs.first &&
lhs.second ==
rhs.second;
328template <
class T1,
class T2>
335template <
class T1,
class T2>
338 return lhs.first <
rhs.first ||
343template <
class T1,
class T2>
350template <
class T1,
class T2>
357template <
class T1,
class T2>
367template <
class T1,
class T2>
411template <
class T1,
class T2>
416#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
422struct KOKKOS_DEPRECATED pair<T1, void> {
423 using first_type = T1;
424 using second_type = void;
429 KOKKOS_DEFAULTED_FUNCTION
constexpr pair() =
default;
431 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
const first_type& f) : first(f) {}
433 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
const first_type& f,
int)
437 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
const pair<U, void>& p)
441 KOKKOS_FORCEINLINE_FUNCTION pair<T1, void>& operator=(
442 const pair<U, void>& p) {
452#if defined(KOKKOS_ENABLE_DEPRECATION_WARNINGS) && \
453 defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU < 1110)
454KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH()
457KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator==(
458 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
459 return lhs.first == rhs.first;
463KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator!=(
464 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
465 return !(lhs == rhs);
469KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator<(
470 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
471 return lhs.first < rhs.first;
475KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator<=(
476 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
481KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator>(
482 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
487KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator>=(
488 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
491#if defined(KOKKOS_ENABLE_DEPRECATION_WARNINGS) && \
492 defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU < 1110)
493KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_POP()
499struct is_pair_like : std::false_type {};
500template <
class T,
class U>
501struct is_pair_like<Kokkos::pair<T, U>> : std::true_type {};
502template <
class T,
class U>
503struct is_pair_like<std::pair<T, U>> : std::true_type {};
509#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PAIR
510#undef KOKKOS_IMPL_PUBLIC_INCLUDE
511#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PAIR
KOKKOS_FORCEINLINE_FUNCTION pair< T1 &, T2 & > tie(T1 &x, T2 &y)
Return a pair of references to the input arguments.
KOKKOS_FORCEINLINE_FUNCTION constexpr pair< T1, T2 > make_pair(T1 x, T2 y)
Return a new pair.
KOKKOS_FORCEINLINE_FUNCTION constexpr bool operator<(const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
Less-than operator for Kokkos::pair.
KOKKOS_FORCEINLINE_FUNCTION constexpr bool operator<=(const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
Less-than-or-equal-to operator for Kokkos::pair.
KOKKOS_FORCEINLINE_FUNCTION constexpr bool operator>=(const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
Greater-than-or-equal-to operator for Kokkos::pair.
KOKKOS_FORCEINLINE_FUNCTION constexpr bool operator>(const pair< T1, T2 > &lhs, const pair< T1, T2 > &rhs)
Greater-than operator for Kokkos::pair.
A thread safe view to a bitset.
Replacement for std::pair that works on CUDA devices.
first_type first
The first element of the pair.
KOKKOS_FORCEINLINE_FUNCTION pair< T1, T2 > & operator=(const pair< U, V > &p)
Assignment operator.
KOKKOS_FORCEINLINE_FUNCTION constexpr pair(first_type const &f, second_type const &s)
Constructor that takes both elements of the pair.
KOKKOS_FORCEINLINE_FUNCTION constexpr pair(const pair< U, V > &p)
Copy constructor.
std::pair< T1, T2 > to_std_pair() const
Return the std::pair version of this object.
second_type second
The second element of the pair.
KOKKOS_DEFAULTED_FUNCTION constexpr pair()=default
Default constructor.