61 #if __cplusplus >= 201103L 64 #if __cplusplus > 201703L 68 namespace std _GLIBCXX_VISIBILITY(default)
70 _GLIBCXX_BEGIN_NAMESPACE_VERSION
77 #if __cplusplus >= 201103L 91 template<std::size_t...>
99 template <
bool,
typename _T1,
typename _T2>
102 template <
typename _U1,
typename _U2>
103 static constexpr
bool _ConstructiblePair()
105 return __and_<is_constructible<_T1, const _U1&>,
109 template <
typename _U1,
typename _U2>
110 static constexpr
bool _ImplicitlyConvertiblePair()
112 return __and_<is_convertible<const _U1&, _T1>,
116 template <
typename _U1,
typename _U2>
117 static constexpr
bool _MoveConstructiblePair()
119 return __and_<is_constructible<_T1, _U1&&>,
123 template <
typename _U1,
typename _U2>
124 static constexpr
bool _ImplicitlyMoveConvertiblePair()
126 return __and_<is_convertible<_U1&&, _T1>,
130 template <
bool __implicit,
typename _U1,
typename _U2>
131 static constexpr
bool _CopyMovePair()
133 using __do_converts = __and_<is_convertible<const _U1&, _T1>,
135 using __converts =
typename conditional<__implicit,
137 __not_<__do_converts>>::type;
138 return __and_<is_constructible<_T1, const _U1&>,
144 template <
bool __implicit,
typename _U1,
typename _U2>
145 static constexpr
bool _MoveCopyPair()
147 using __do_converts = __and_<is_convertible<_U1&&, _T1>,
149 using __converts =
typename conditional<__implicit,
151 __not_<__do_converts>>::type;
152 return __and_<is_constructible<_T1, _U1&&>,
159 template <
typename _T1,
typename _T2>
160 struct _PCC<false, _T1, _T2>
162 template <
typename _U1,
typename _U2>
163 static constexpr
bool _ConstructiblePair()
168 template <
typename _U1,
typename _U2>
169 static constexpr
bool _ImplicitlyConvertiblePair()
174 template <
typename _U1,
typename _U2>
175 static constexpr
bool _MoveConstructiblePair()
180 template <
typename _U1,
typename _U2>
181 static constexpr
bool _ImplicitlyMoveConvertiblePair()
188 template<
typename _U1,
typename _U2>
class __pair_base
190 #if __cplusplus >= 201103L 191 template<
typename _T1,
typename _T2>
friend struct pair;
192 __pair_base() =
default;
193 ~__pair_base() =
default;
194 __pair_base(
const __pair_base&) =
default;
195 __pair_base& operator=(
const __pair_base&) =
delete;
209 template<
typename _T1,
typename _T2>
211 :
private __pair_base<_T1, _T2>
223 #if __cplusplus >= 201103L 224 template <
typename _U1 = _T1,
227 __is_implicitly_default_constructible<_U1>,
228 __is_implicitly_default_constructible<_U2>>
229 ::value,
bool>::type =
true>
232 : first(), second() { }
234 #if __cplusplus >= 201103L 235 template <
typename _U1 = _T1,
241 __and_<__is_implicitly_default_constructible<_U1>,
242 __is_implicitly_default_constructible<_U2>>>>
243 ::value,
bool>::type =
false>
244 explicit constexpr
pair()
245 : first(), second() { }
248 #if __cplusplus < 201103L 250 pair(
const _T1& __a,
const _T2& __b)
251 : first(__a), second(__b) { }
255 using _PCCP = _PCC<true, _T1, _T2>;
259 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 261 _ConstructiblePair<_U1, _U2>()
263 _ImplicitlyConvertiblePair<_U1, _U2>(),
265 constexpr
pair(
const _T1& __a,
const _T2& __b)
266 : first(__a), second(__b) { }
269 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 271 _ConstructiblePair<_U1, _U2>()
273 _ImplicitlyConvertiblePair<_U1, _U2>(),
275 explicit constexpr
pair(
const _T1& __a,
const _T2& __b)
276 : first(__a), second(__b) { }
279 #if __cplusplus < 201103L 281 template<
typename _U1,
typename _U2>
287 template <
typename _U1,
typename _U2>
288 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
293 template<
typename _U1,
typename _U2,
typename 295 _ConstructiblePair<_U1, _U2>()
296 && _PCCFP<_U1, _U2>::template
297 _ImplicitlyConvertiblePair<_U1, _U2>(),
302 template<
typename _U1,
typename _U2,
typename 304 _ConstructiblePair<_U1, _U2>()
305 && !_PCCFP<_U1, _U2>::template
306 _ImplicitlyConvertiblePair<_U1, _U2>(),
312 #if __cplusplus >= 201103L 313 constexpr pair(
const pair&) =
default;
314 constexpr pair(pair&&) =
default;
317 template<
typename _U1,
typename 319 _MoveCopyPair<true, _U1, _T2>(),
321 constexpr pair(_U1&& __x,
const _T2& __y)
322 : first(std::forward<_U1>(__x)), second(__y) { }
324 template<
typename _U1,
typename 326 _MoveCopyPair<false, _U1, _T2>(),
328 explicit constexpr pair(_U1&& __x,
const _T2& __y)
329 : first(std::forward<_U1>(__x)), second(__y) { }
331 template<
typename _U2,
typename 333 _CopyMovePair<true, _T1, _U2>(),
335 constexpr pair(
const _T1& __x, _U2&& __y)
336 : first(__x), second(std::forward<_U2>(__y)) { }
338 template<
typename _U2,
typename 340 _CopyMovePair<false, _T1, _U2>(),
342 explicit pair(
const _T1& __x, _U2&& __y)
343 : first(__x), second(std::forward<_U2>(__y)) { }
345 template<
typename _U1,
typename _U2,
typename 347 _MoveConstructiblePair<_U1, _U2>()
349 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
351 constexpr pair(_U1&& __x, _U2&& __y)
352 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
354 template<
typename _U1,
typename _U2,
typename 356 _MoveConstructiblePair<_U1, _U2>()
358 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
360 explicit constexpr pair(_U1&& __x, _U2&& __y)
361 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
364 template<
typename _U1,
typename _U2,
typename 366 _MoveConstructiblePair<_U1, _U2>()
367 && _PCCFP<_U1, _U2>::template
368 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
371 : first(std::forward<_U1>(__p.
first)),
372 second(std::forward<_U2>(__p.
second)) { }
374 template<
typename _U1,
typename _U2,
typename 376 _MoveConstructiblePair<_U1, _U2>()
377 && !_PCCFP<_U1, _U2>::template
378 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
381 : first(std::forward<_U1>(__p.
first)),
382 second(std::forward<_U2>(__p.
second)) { }
384 template<
typename... _Args1,
typename... _Args2>
388 _GLIBCXX20_CONSTEXPR pair&
392 const pair&,
const __nonesuch&>::type __p)
399 _GLIBCXX20_CONSTEXPR pair&
403 pair&&, __nonesuch&&>::type __p)
407 first = std::forward<first_type>(__p.first);
408 second = std::forward<second_type>(__p.second);
412 template<
typename _U1,
typename _U2>
424 template<
typename _U1,
typename _U2>
431 first = std::forward<_U1>(__p.
first);
432 second = std::forward<_U2>(__p.
second);
437 _GLIBCXX20_CONSTEXPR
void 439 noexcept(__and_<__is_nothrow_swappable<_T1>,
440 __is_nothrow_swappable<_T2>>::value)
443 swap(first, __p.
first);
448 template<
typename... _Args1, std::size_t... _Indexes1,
449 typename... _Args2, std::size_t... _Indexes2>
452 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
458 #if __cpp_deduction_guides >= 201606 463 template<
typename _T1,
typename _T2>
464 inline _GLIBCXX_CONSTEXPR
bool 468 #if __cpp_lib_three_way_comparison && __cpp_lib_concepts 469 template<
typename _T1,
typename _T2>
470 constexpr common_comparison_category_t<__detail::__synth3way_t<_T1>,
471 __detail::__synth3way_t<_T2>>
474 if (
auto __c = __detail::__synth3way(__x.
first, __y.
first); __c != 0)
486 template<
typename _T1,
typename _T2>
487 inline _GLIBCXX_CONSTEXPR
bool 490 || (!(__y.
first < __x.first) && __x.second < __y.
second); }
493 template<
typename _T1,
typename _T2>
494 inline _GLIBCXX_CONSTEXPR
bool 496 {
return !(__x == __y); }
499 template<
typename _T1,
typename _T2>
500 inline _GLIBCXX_CONSTEXPR
bool 502 {
return __y < __x; }
505 template<
typename _T1,
typename _T2>
506 inline _GLIBCXX_CONSTEXPR
bool 508 {
return !(__y < __x); }
511 template<
typename _T1,
typename _T2>
512 inline _GLIBCXX_CONSTEXPR
bool 514 {
return !(__x < __y); }
515 #endif // !(three_way_comparison && concepts) 517 #if __cplusplus >= 201103L 523 template<
typename _T1,
typename _T2>
524 _GLIBCXX20_CONSTEXPR
inline 525 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 528 __is_swappable<_T2>>::value>::type
533 noexcept(noexcept(__x.swap(__y)))
536 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 537 template<
typename _T1,
typename _T2>
539 __is_swappable<_T2>>::value>::type
542 #endif // __cplusplus >= 201103L 561 #if __cplusplus >= 201103L 563 template<
typename _T1,
typename _T2>
565 typename __decay_and_strip<_T2>::__type>
568 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
569 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
571 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
574 template<
typename _T1,
typename _T2>
576 make_pair(_T1 __x, _T2 __y)
582 _GLIBCXX_END_NAMESPACE_VERSION
constexpr enable_if< __and_< __is_swappable< _T1 >, __is_swappable< _T2 > >::value >::type swap(pair< _T1, _T2 > &__x, pair< _T1, _T2 > &__y) noexcept(noexcept(__x.swap(__y)))
constexpr pair(const _T1 &__a, const _T2 &__b)
Construct from two const lvalues, allowing implicit conversions.
constexpr bool operator==(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Two pairs of the same type are equal iff their members are equal.
constexpr bool operator>=(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Uses operator< to find the result.
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
Define a member typedef type to one of two argument types.
constexpr bool operator>(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Uses operator< to find the result.
Struct holding two objects of arbitrary type.
_T2 second
The second member.
_T1 first_type
The type of the first member.
Tag type for piecewise construction of std::pair objects.
_T2 second_type
The type of the second member.
constexpr void swap(pair &__p) noexcept(__and_< __is_nothrow_swappable< _T1 >, __is_nothrow_swappable< _T2 >>::value)
Swap the first members and then the second members.
constexpr bool operator!=(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Uses operator== to find the result.
ISO C++ entities toplevel namespace is std.
is_nothrow_move_assignable
_T1 first
The first member.
Primary class template, tuple.
Define a member typedef type only if a boolean constant is true.
constexpr piecewise_construct_t piecewise_construct
Tag for piecewise construction of std::pair objects.