1 #ifndef DASH_DASH_INCLUDE_DASH_PAIR_H_ 2 #define DASH_DASH_INCLUDE_DASH_PAIR_H_ 21 template<
class T1,
class T2>
24 typedef T1 first_type;
40 constexpr
Pair(
const T1& __a,
const T2& __b)
41 : first(__a), second(__b)
48 template<
class U1,
class U2,
class =
typename 50 std::is_convertible<const U1&, T1>::value &&
51 std::is_convertible<const U2&, T2>::value>::value>
53 : first(p.first), second(p.second)
56 constexpr
Pair(
const Pair&) =
default;
59 template<
class U1,
class =
typename 60 std::enable_if<std::is_convertible<U1, T1>::value>::type>
61 constexpr
Pair(U1&& x,
const T2& y)
65 template<
class U2,
class =
typename 66 std::enable_if<std::is_convertible<U2, T2>::value>::type>
67 constexpr
Pair(
const T1& x, U2&& y)
71 template<
class U1,
class U2,
class =
typename 72 std::enable_if<std::is_convertible<U1, T1>::value &&
73 std::is_convertible<U2, T2>::value>::type>
74 constexpr
Pair(U1&& x, U2&& y)
75 :
first(std::forward<U1>(x)),
second(std::forward<U2>(y))
78 template<
class U1,
class U2,
class =
typename 79 std::enable_if<std::is_convertible<U1, T1>::value &&
80 std::is_convertible<U2, T2>::value>::type>
82 :
first(std::forward<U1>(p.first)),
83 second(std::forward<U2>(p.second))
87 operator=(
const Pair& p) =
default;
92 std::is_nothrow_move_assignable<T1>::value &&
93 std::is_nothrow_move_assignable<T2>::value) =
default;
95 template<
class U1,
class U2>
104 template<
class U1,
class U2>
108 first = std::forward<U1>(p.
first);
109 second = std::forward<U2>(p.
second);
115 noexcept(noexcept(swap(first, p.
first))
116 && noexcept(swap(second, p.
second)))
118 std::swap(first, p.
first);
119 std::swap(second, p.
second);
126 template<
class T1,
class T2>
127 inline constexpr
bool 138 template<
class T1,
class T2>
139 inline constexpr
bool 142 return x.
first < y.first
143 || (!(y.first < x.first) && !(x.second >= y.second));
150 template<
class T1,
class T2>
151 inline constexpr
bool 160 template<
class T1,
class T2>
161 inline constexpr
bool 170 template<
class T1,
class T2>
171 inline constexpr
bool 180 template<
class T1,
class T2>
181 inline constexpr
bool 190 template<
class T1,
class T2>
193 noexcept(noexcept(x.swap(y)))
208 struct strip<std::reference_wrapper<T>>
213 struct decay_and_strip
215 typedef typename strip<typename std::decay<T>::type>::type type;
222 template<
class T1,
class T2>
224 typename internal::decay_and_strip<T2>::type>
227 typedef typename internal::decay_and_strip<T1>::type ds_type1;
228 typedef typename internal::decay_and_strip<T2>::type ds_type2;
230 return pair_type(std::forward<T1>(x), std::forward<T2>(y));
233 template<
class T1,
class T2>
234 std::ostream & operator<<(
238 std::ostringstream ss;
240 <<
" { " << pair.
first 243 return operator<<(os, ss.str());
This class is a simple memory pool which holds allocates elements of size ValueType.
constexpr Pair< typename internal::decay_and_strip< T1 >::type, typename internal::decay_and_strip< T2 >::type > make_pair(T1 &&x, T2 &&y)
Convennience wrapper to create a Pair object.
T1 first
second_type is the second bound type
constexpr bool operator>=(const Pair< T1, T2 > &x, const Pair< T1, T2 > &y)
Greater-than-or-equal operator implemented in terms of less-than operator.
constexpr bool operator>(const Pair< T1, T2 > &x, const Pair< T1, T2 > &y)
Greater-than operator implemented in terms of less-than operator.
T2 second_type
first_type is the first bound type
T2 second
first is a copy of the first object
std::string typestr(const T &obj)
Returns string containing the type name of the given object.
constexpr Pair(const T1 &__a, const T2 &__b)
Two objects may be passed to a Pair constructor to be copied.
constexpr Pair()
second is a copy of the second object
A trivially-copyable implementation of std::pair to be used as element type of DASH containers...
constexpr Pair(const Pair< U1, U2 > &p)
A Pair might be constructed from another pair iff first and second are convertible.