48 #ifndef KOKKOS_PAIR_HPP
49 #define KOKKOS_PAIR_HPP
51 #include <Kokkos_Macros.hpp>
63 template <
class T1,
class T2>
81 KOKKOS_FORCEINLINE_FUNCTION constexpr
82 #ifdef KOKKOS_CUDA_9_DEFAULTED_BUG_WORKAROUND
92 KOKKOS_FORCEINLINE_FUNCTION constexpr
101 template <
class U,
class V>
102 KOKKOS_FORCEINLINE_FUNCTION constexpr
111 template <
class U,
class V>
112 KOKKOS_FORCEINLINE_FUNCTION constexpr
121 template <
class U,
class V>
122 KOKKOS_FORCEINLINE_FUNCTION
142 template <
class U,
class V>
143 KOKKOS_FORCEINLINE_FUNCTION
153 template <
class U,
class V>
154 pair(
const std::pair<U,V> &p)
171 template <
class T1,
class T2>
172 struct pair<T1&, T2&>
175 typedef T1& first_type;
177 typedef T2& second_type;
188 KOKKOS_FORCEINLINE_FUNCTION constexpr
189 pair(first_type f, second_type s)
190 : first(f), second(s)
197 template <
class U,
class V>
198 KOKKOS_FORCEINLINE_FUNCTION constexpr
199 pair(
const pair<U,V> &p)
200 : first(p.first), second(p.second)
204 template <
class U,
class V>
205 pair(
const std::pair<U,V> &p)
206 : first(p.first), second(p.second)
213 template <
class U,
class V>
214 KOKKOS_FORCEINLINE_FUNCTION
215 pair<first_type, second_type> & operator=(
const pair<U,V> &p)
231 std::pair<T1,T2> to_std_pair()
const
235 template <
class T1,
class T2>
239 typedef T1 first_type;
241 typedef T2& second_type;
252 KOKKOS_FORCEINLINE_FUNCTION constexpr
253 pair(first_type
const& f, second_type s)
254 : first(f), second(s)
261 template <
class U,
class V>
262 KOKKOS_FORCEINLINE_FUNCTION constexpr
263 pair(
const pair<U,V> &p)
264 : first(p.first), second(p.second)
268 template <
class U,
class V>
269 pair(
const std::pair<U,V> &p)
270 : first(p.first), second(p.second)
277 template <
class U,
class V>
278 KOKKOS_FORCEINLINE_FUNCTION
279 pair<first_type, second_type> & operator=(
const pair<U,V> &p)
295 std::pair<T1,T2> to_std_pair()
const
299 template <
class T1,
class T2>
303 typedef T1& first_type;
305 typedef T2 second_type;
316 KOKKOS_FORCEINLINE_FUNCTION constexpr
317 pair(first_type f, second_type
const& s)
318 : first(f), second(s)
325 template <
class U,
class V>
326 KOKKOS_FORCEINLINE_FUNCTION constexpr
327 pair(
const pair<U,V> &p)
328 : first(p.first), second(p.second)
332 template <
class U,
class V>
333 pair(
const std::pair<U,V> &p)
334 : first(p.first), second(p.second)
341 template <
class U,
class V>
342 KOKKOS_FORCEINLINE_FUNCTION
343 pair<first_type, second_type> & operator=(
const pair<U,V> &p)
359 std::pair<T1,T2> to_std_pair()
const
364 template <
class T1,
class T2>
365 KOKKOS_FORCEINLINE_FUNCTION
370 template <
class T1,
class T2>
371 KOKKOS_FORCEINLINE_FUNCTION constexpr
373 {
return !(lhs==rhs); }
376 template <
class T1,
class T2>
377 KOKKOS_FORCEINLINE_FUNCTION constexpr
379 {
return lhs.
first<rhs.first || (!(rhs.first<lhs.first) && lhs.second<rhs.second); }
382 template <
class T1,
class T2>
383 KOKKOS_FORCEINLINE_FUNCTION constexpr
385 {
return !(rhs<lhs); }
388 template <
class T1,
class T2>
389 KOKKOS_FORCEINLINE_FUNCTION constexpr
394 template <
class T1,
class T2>
395 KOKKOS_FORCEINLINE_FUNCTION constexpr
397 {
return !(lhs<rhs); }
403 template <
class T1,
class T2>
404 KOKKOS_FORCEINLINE_FUNCTION constexpr
447 template <
class T1,
class T2>
448 KOKKOS_FORCEINLINE_FUNCTION
465 KOKKOS_FORCEINLINE_FUNCTION constexpr
466 #ifdef KOKKOS_CUDA_9_DEFAULTED_BUG_WORKAROUND
472 KOKKOS_FORCEINLINE_FUNCTION constexpr
477 KOKKOS_FORCEINLINE_FUNCTION constexpr
483 KOKKOS_FORCEINLINE_FUNCTION constexpr
484 pair(
const pair<U,void> &p)
489 KOKKOS_FORCEINLINE_FUNCTION
490 pair<T1, void> &
operator=(
const pair<U,void> &p)
502 KOKKOS_FORCEINLINE_FUNCTION constexpr
503 bool operator== (
const pair<T1,void>& lhs,
const pair<T1,void>& rhs)
504 {
return lhs.first==rhs.first; }
507 KOKKOS_FORCEINLINE_FUNCTION constexpr
508 bool operator!= (
const pair<T1,void>& lhs,
const pair<T1,void>& rhs)
509 {
return !(lhs==rhs); }
512 KOKKOS_FORCEINLINE_FUNCTION constexpr
513 bool operator< (const pair<T1,void>& lhs,
const pair<T1,void>& rhs)
514 {
return lhs.first<rhs.first; }
517 KOKKOS_FORCEINLINE_FUNCTION constexpr
518 bool operator<= (const pair<T1,void>& lhs,
const pair<T1,void>& rhs)
519 {
return !(rhs<lhs); }
522 KOKKOS_FORCEINLINE_FUNCTION constexpr
523 bool operator> (
const pair<T1,void>& lhs,
const pair<T1,void>& rhs)
527 KOKKOS_FORCEINLINE_FUNCTION constexpr
528 bool operator>= (
const pair<T1,void>& lhs,
const pair<T1,void>& rhs)
529 {
return !(lhs<rhs); }
534 #endif //KOKKOS_PAIR_HPP
KOKKOS_INLINE_FUNCTION bool operator==(const complex< RealType1 > &x, const complex< RealType2 > &y)
Equality operator for two complex numbers.
KOKKOS_INLINE_FUNCTION bool operator!=(const complex< RealType1 > &x, const complex< RealType2 > &y)
Inequality operator for two complex numbers.
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 pair(const volatile pair< U, V > &p)
Copy constructor.
T2 second_type
The second template parameter of this class.
Replacement for std::pair that works on CUDA devices.
std::pair< T1, T2 > to_std_pair() const
Return the std::pair version of this object.
first_type first
The first element of the pair.
KOKKOS_FORCEINLINE_FUNCTION constexpr pair(first_type const &f, second_type const &s)
Constructor that takes both elements of the pair.
T1 first_type
The first template parameter of this class.
KOKKOS_FORCEINLINE_FUNCTION void operator=(const volatile pair< U, V > &p) volatile
Assignment operator, for volatile *this.
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)
Greater-than operator for Kokkos::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(const pair< U, V > &p)
Copy constructor.
second_type second
The second element of the pair.
KOKKOS_FORCEINLINE_FUNCTION pair< T1, T2 > & operator=(const pair< U, V > &p)
Assignment operator.
KOKKOS_FORCEINLINE_FUNCTION constexpr pair()=default
Default constructor.