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>
42template <
class T1,
class T2>
59 KOKKOS_DEFAULTED_FUNCTION
constexpr pair() =
default;
65#ifdef KOKKOS_COMPILER_NVHPC
67 KOKKOS_FORCEINLINE_FUNCTION
69 KOKKOS_FORCEINLINE_FUNCTION
constexpr
77 template <
class U,
class V>
78#ifdef KOKKOS_COMPILER_NVHPC
80 KOKKOS_FORCEINLINE_FUNCTION
82 KOKKOS_FORCEINLINE_FUNCTION
constexpr
88#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
93 template <
class U,
class V>
94 KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
103 template <
class U,
class V>
110#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
122 template <
class U,
class V>
123 KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION
void operator=(
133 template <
class U,
class V>
150template <
class T1,
class T2>
151struct pair<T1&, T2&> {
153 using first_type = T1&;
155 using second_type = T2&;
166 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(first_type f, second_type s)
167 : first(f), second(s) {}
173 template <
class U,
class V>
174 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
const pair<U, V>& p)
175 : first(p.first), second(p.second) {}
178 template <
class U,
class V>
179 pair(
const std::pair<U, V>& p) : first(p.first), second(p.second) {}
185 template <
class U,
class V>
186 KOKKOS_FORCEINLINE_FUNCTION pair<first_type, second_type>& operator=(
187 const pair<U, V>& p) {
202 std::pair<T1, T2> to_std_pair()
const {
203 return std::make_pair(first, second);
207template <
class T1,
class T2>
208struct pair<T1, T2&> {
210 using first_type = T1;
212 using second_type = T2&;
223 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(first_type
const& f, second_type s)
224 : first(f), second(s) {}
230 template <
class U,
class V>
231 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
const pair<U, V>& p)
232 : first(p.first), second(p.second) {}
235 template <
class U,
class V>
236 pair(
const std::pair<U, V>& p) : first(p.first), second(p.second) {}
242 template <
class U,
class V>
243 KOKKOS_FORCEINLINE_FUNCTION pair<first_type, second_type>& operator=(
244 const pair<U, V>& p) {
259 std::pair<T1, T2> to_std_pair()
const {
260 return std::make_pair(first, second);
264template <
class T1,
class T2>
265struct pair<T1&, T2> {
267 using first_type = T1&;
269 using second_type = T2;
280 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(first_type f, second_type
const& s)
281 : first(f), second(s) {}
287 template <
class U,
class V>
288 KOKKOS_FORCEINLINE_FUNCTION
constexpr pair(
const pair<U, V>& p)
289 : first(p.first), second(p.second) {}
292 template <
class U,
class V>
293 pair(
const std::pair<U, V>& p) : first(p.first), second(p.second) {}
299 template <
class U,
class V>
300 KOKKOS_FORCEINLINE_FUNCTION pair<first_type, second_type>& operator=(
301 const pair<U, V>& p) {
316 std::pair<T1, T2> to_std_pair()
const {
317 return std::make_pair(first, second);
322template <
class T1,
class T2>
323KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator==(
const pair<T1, T2>& lhs,
329template <
class T1,
class T2>
330KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator!=(
const pair<T1, T2>& lhs,
332 return !(lhs == rhs);
336template <
class T1,
class T2>
344template <
class T1,
class T2>
351template <
class T1,
class T2>
358template <
class T1,
class T2>
368template <
class T1,
class T2>
412template <
class T1,
class T2>
422struct pair<T1, void> {
429 KOKKOS_DEFAULTED_FUNCTION
constexpr pair() =
default;
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) {
453KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator==(
454 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
455 return lhs.first == rhs.first;
459KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator!=(
460 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
461 return !(lhs == rhs);
465KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator<(
466 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
467 return lhs.first < rhs.first;
471KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator<=(
472 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
477KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator>(
478 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
483KOKKOS_FORCEINLINE_FUNCTION
constexpr bool operator>=(
484 const pair<T1, void>& lhs,
const pair<T1, void>& rhs) {
491struct is_pair_like : std::false_type {};
492template <
class T,
class U>
493struct is_pair_like<Kokkos::pair<T, U>> : std::true_type {};
494template <
class T,
class U>
495struct is_pair_like<std::pair<T, U>> : std::true_type {};
501#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_PAIR
502#undef KOKKOS_IMPL_PUBLIC_INCLUDE
503#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.
Replacement for std::pair that works on CUDA devices.
T2 second_type
The second template parameter of this class.
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.
T1 first_type
The first template parameter of this class.