59 #if __cplusplus >= 201103L 64 #if __cplusplus >= 202002L 68 namespace std _GLIBCXX_VISIBILITY(default)
70 _GLIBCXX_BEGIN_NAMESPACE_VERSION
77 #if __cplusplus >= 201103L 88 template<
typename _T1,
typename _T2>
98 template<
typename _Tp,
size_t _Nm>
104 template<
typename _Tp>
107 template<
size_t _Int,
class _Tp1,
class _Tp2>
111 template<
size_t _Int,
class _Tp1,
class _Tp2>
115 template<
size_t _Int,
class _Tp1,
class _Tp2>
119 template<
size_t _Int,
class _Tp1,
class _Tp2>
123 template<
size_t __i,
typename... _Elements>
124 constexpr __tuple_element_t<__i,
tuple<_Elements...>>&
125 get(
tuple<_Elements...>& __t) noexcept;
127 template<
size_t __i,
typename... _Elements>
128 constexpr
const __tuple_element_t<__i,
tuple<_Elements...>>&
129 get(
const tuple<_Elements...>& __t) noexcept;
131 template<
size_t __i,
typename... _Elements>
132 constexpr __tuple_element_t<__i,
tuple<_Elements...>>&&
133 get(
tuple<_Elements...>&& __t) noexcept;
135 template<
size_t __i,
typename... _Elements>
136 constexpr
const __tuple_element_t<__i,
tuple<_Elements...>>&&
137 get(
const tuple<_Elements...>&& __t) noexcept;
139 template<
size_t _Int,
typename _Tp,
size_t _Nm>
143 template<
size_t _Int,
typename _Tp,
size_t _Nm>
147 template<
size_t _Int,
typename _Tp,
size_t _Nm>
151 template<
size_t _Int,
typename _Tp,
size_t _Nm>
152 constexpr
const _Tp&&
155 #if __glibcxx_tuple_like >= 202311 // >= C++26 156 template<
size_t _Int,
typename _Tp>
159 template<
size_t _Int,
typename _Tp>
162 template<
size_t _Int,
typename _Tp>
165 template<
size_t _Int,
typename _Tp>
166 constexpr
const _Tp&&
170 #if ! __cpp_lib_concepts 176 template <
bool,
typename _T1,
typename _T2>
179 template <
typename _U1,
typename _U2>
180 static constexpr
bool _ConstructiblePair()
182 return __and_<is_constructible<_T1, const _U1&>,
186 template <
typename _U1,
typename _U2>
187 static constexpr
bool _ImplicitlyConvertiblePair()
189 return __and_<is_convertible<const _U1&, _T1>,
190 is_convertible<const _U2&, _T2>>::value;
193 template <
typename _U1,
typename _U2>
194 static constexpr
bool _MoveConstructiblePair()
196 return __and_<is_constructible<_T1, _U1&&>,
200 template <
typename _U1,
typename _U2>
201 static constexpr
bool _ImplicitlyMoveConvertiblePair()
203 return __and_<is_convertible<_U1&&, _T1>,
204 is_convertible<_U2&&, _T2>>::value;
208 template <
typename _T1,
typename _T2>
209 struct _PCC<false, _T1, _T2>
211 template <
typename _U1,
typename _U2>
212 static constexpr
bool _ConstructiblePair()
217 template <
typename _U1,
typename _U2>
218 static constexpr
bool _ImplicitlyConvertiblePair()
223 template <
typename _U1,
typename _U2>
224 static constexpr
bool _MoveConstructiblePair()
229 template <
typename _U1,
typename _U2>
230 static constexpr
bool _ImplicitlyMoveConvertiblePair()
235 #endif // lib concepts 238 #if __glibcxx_tuple_like // >= C++23 239 template<
typename _Tp>
240 inline constexpr
bool __is_tuple_v =
false;
242 template<
typename... _Ts>
243 inline constexpr
bool __is_tuple_v<
tuple<_Ts...>> =
true;
246 template<
typename _Tp>
247 inline constexpr
bool __is_tuple_like_v =
false;
249 template<
typename... _Elements>
250 inline constexpr
bool __is_tuple_like_v<
tuple<_Elements...>> =
true;
252 template<
typename _T1,
typename _T2>
253 inline constexpr
bool __is_tuple_like_v<pair<_T1, _T2>> =
true;
255 template<
typename _Tp,
size_t _Nm>
256 inline constexpr
bool __is_tuple_like_v<array<_Tp, _Nm>> =
true;
260 template<
typename _Tp>
261 concept __tuple_like = __is_tuple_like_v<remove_cvref_t<_Tp>>;
263 template<
typename _Tp>
264 concept __pair_like = __tuple_like<_Tp> && tuple_size_v<remove_cvref_t<_Tp>> == 2;
266 template<
typename _Tp,
typename _Tuple>
267 concept __eligible_tuple_like
268 = __detail::__different_from<_Tp, _Tuple> && __tuple_like<_Tp>
269 && (tuple_size_v<remove_cvref_t<_Tp>> == tuple_size_v<_Tuple>)
270 && !ranges::__detail::__is_subrange<remove_cvref_t<_Tp>>;
272 template<
typename _Tp,
typename _Pair>
273 concept __eligible_pair_like
274 = __detail::__different_from<_Tp, _Pair> && __pair_like<_Tp>
275 && !ranges::__detail::__is_subrange<remove_cvref_t<_Tp>>;
278 template<
typename _U1,
typename _U2>
class __pair_base
280 #if __cplusplus >= 201103L && ! __cpp_lib_concepts 281 template<
typename _T1,
typename _T2>
friend struct pair;
282 __pair_base() =
default;
283 ~__pair_base() =
default;
284 __pair_base(
const __pair_base&) =
default;
285 __pair_base& operator=(
const __pair_base&) =
delete;
301 template<
typename _T1,
typename _T2>
303 :
public __pair_base<_T1, _T2>
311 #if __cplusplus >= 201103L 312 constexpr
pair(
const pair&) =
default;
315 template<
typename... _Args1,
typename... _Args2>
320 _GLIBCXX20_CONSTEXPR
void 322 noexcept(__and_<__is_nothrow_swappable<_T1>,
323 __is_nothrow_swappable<_T2>>::value)
326 swap(first, __p.first);
327 swap(second, __p.second);
330 #if __glibcxx_ranges_zip // >= C++23 338 swap(
const pair& __p)
const 339 noexcept(__and_v<__is_nothrow_swappable<const _T1>,
340 __is_nothrow_swappable<const _T2>>)
341 requires is_swappable_v<const _T1> && is_swappable_v<const _T2>
344 swap(first, __p.
first);
350 template<
typename... _Args1,
size_t... _Indexes1,
351 typename... _Args2,
size_t... _Indexes2>
354 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
357 #if __cpp_lib_concepts 362 explicit(__not_<__and_<__is_implicitly_default_constructible<_T1>,
363 __is_implicitly_default_constructible<_T2>>>())
365 noexcept(is_nothrow_default_constructible_v<_T1>
366 && is_nothrow_default_constructible_v<_T2>)
367 requires is_default_constructible_v<_T1>
368 && is_default_constructible_v<_T2>
375 template<
typename _U1,
typename _U2>
376 static constexpr
bool 379 if constexpr (is_constructible_v<_T1, _U1>)
380 return is_constructible_v<_T2, _U2>;
384 template<
typename _U1,
typename _U2>
385 static constexpr
bool 386 _S_nothrow_constructible()
388 if constexpr (is_nothrow_constructible_v<_T1, _U1>)
389 return is_nothrow_constructible_v<_T2, _U2>;
393 template<
typename _U1,
typename _U2>
394 static constexpr
bool 397 if constexpr (is_convertible_v<_U1, _T1>)
398 return is_convertible_v<_U2, _T2>;
403 template<
typename _U1,
typename _U2>
404 static constexpr
bool 407 #if __has_builtin(__reference_constructs_from_temporary) 408 if constexpr (__reference_constructs_from_temporary(_T1, _U1&&))
411 return __reference_constructs_from_temporary(_T2, _U2&&);
417 #if __glibcxx_tuple_like // >= C++23 418 template<
typename _UPair>
419 static constexpr
bool 420 _S_constructible_from_pair_like()
422 return _S_constructible<decltype(std::get<0>(std::declval<_UPair>())),
423 decltype(std::get<1>(std::declval<_UPair>()))>();
426 template<
typename _UPair>
427 static constexpr
bool 428 _S_convertible_from_pair_like()
430 return _S_convertible<decltype(std::get<0>(std::declval<_UPair>())),
431 decltype(std::get<1>(std::declval<_UPair>()))>();
434 template<
typename _UPair>
435 static constexpr
bool 436 _S_dangles_from_pair_like()
438 return _S_dangles<decltype(std::get<0>(std::declval<_UPair>())),
439 decltype(std::get<1>(std::declval<_UPair>()))>();
447 constexpr
explicit(!_S_convertible<const _T1&, const _T2&>())
448 pair(
const type_identity_t<_T1>& __x,
const _T2& __y)
449 noexcept(_S_nothrow_constructible<const _T1&, const _T2&>())
450 requires (_S_constructible<const _T1&, const _T2&>())
451 : first(__x), second(__y)
455 #if __cplusplus > 202002L 456 template<
typename _U1 = _T1,
typename _U2 = _T2>
458 template<
typename _U1,
typename _U2>
460 requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>())
461 constexpr
explicit(!_S_convertible<_U1, _U2>())
462 pair(_U1&& __x, _U2&& __y)
463 noexcept(_S_nothrow_constructible<_U1, _U2>())
464 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y))
467 #if __cplusplus > 202002L 468 template<
typename _U1 = _T1,
typename _U2 = _T2>
470 template<
typename _U1,
typename _U2>
472 requires (_S_constructible<_U1, _U2>()) && (_S_dangles<_U1, _U2>())
473 constexpr
explicit(!_S_convertible<_U1, _U2>())
474 pair(_U1&&, _U2&&) =
delete;
477 template<
typename _U1,
typename _U2>
478 requires (_S_constructible<const _U1&, const _U2&>())
479 && (!_S_dangles<_U1, _U2>())
480 constexpr
explicit(!_S_convertible<const _U1&, const _U2&>())
482 noexcept(_S_nothrow_constructible<const _U1&, const _U2&>())
486 template<
typename _U1,
typename _U2>
487 requires (_S_constructible<const _U1&, const _U2&>())
488 && (_S_dangles<const _U1&, const _U2&>())
489 constexpr
explicit(!_S_convertible<const _U1&, const _U2&>())
493 template<
typename _U1,
typename _U2>
494 requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>())
495 constexpr
explicit(!_S_convertible<_U1, _U2>())
497 noexcept(_S_nothrow_constructible<_U1, _U2>())
498 : first(std::forward<_U1>(__p.
first)),
499 second(std::forward<_U2>(__p.
second))
502 template<
typename _U1,
typename _U2>
503 requires (_S_constructible<_U1, _U2>()) && (_S_dangles<_U1, _U2>())
504 constexpr
explicit(!_S_convertible<_U1, _U2>())
507 #if __glibcxx_ranges_zip // >= C++23 509 template<
typename _U1,
typename _U2>
510 requires (_S_constructible<_U1&, _U2&>()) && (!_S_dangles<_U1&, _U2&>())
511 constexpr
explicit(!_S_convertible<_U1&, _U2&>())
513 noexcept(_S_nothrow_constructible<_U1&, _U2&>())
517 template<
typename _U1,
typename _U2>
518 requires (_S_constructible<_U1&, _U2&>()) && (_S_dangles<_U1&, _U2&>())
519 constexpr
explicit(!_S_convertible<_U1&, _U2&>())
523 template<
typename _U1,
typename _U2>
524 requires (_S_constructible<const _U1, const _U2>())
525 && (!_S_dangles<const _U1, const _U2>())
526 constexpr
explicit(!_S_convertible<const _U1, const _U2>())
528 noexcept(_S_nothrow_constructible<const _U1, const _U2>())
529 : first(std::forward<const _U1>(__p.
first)),
530 second(std::forward<const _U2>(__p.
second))
533 template<
typename _U1,
typename _U2>
534 requires (_S_constructible<const _U1, const _U2>())
535 && (_S_dangles<const _U1, const _U2>())
536 constexpr
explicit(!_S_convertible<const _U1, const _U2>())
540 #if __glibcxx_tuple_like // >= C++23 541 template<__eligible_pair_like<pair> _UPair>
542 requires (_S_constructible_from_pair_like<_UPair>())
543 && (!_S_dangles_from_pair_like<_UPair>())
544 constexpr
explicit(!_S_convertible_from_pair_like<_UPair>())
546 : first(std::get<0>(std::forward<_UPair>(__p))),
547 second(std::get<1>(std::forward<_UPair>(__p)))
550 template<__eligible_pair_like<pair> _UPair>
551 requires (_S_constructible_from_pair_like<_UPair>())
552 && (_S_dangles_from_pair_like<_UPair>())
553 constexpr
explicit(!_S_convertible_from_pair_like<_UPair>())
554 pair(_UPair&&) =
delete;
559 template<
typename _U1,
typename _U2>
560 static constexpr
bool 563 if constexpr (is_assignable_v<_T1&, _U1>)
564 return is_assignable_v<_T2&, _U2>;
568 template<
typename _U1,
typename _U2>
569 static constexpr
bool 570 _S_const_assignable()
572 if constexpr (is_assignable_v<const _T1&, _U1>)
573 return is_assignable_v<const _T2&, _U2>;
577 template<
typename _U1,
typename _U2>
578 static constexpr
bool 579 _S_nothrow_assignable()
581 if constexpr (is_nothrow_assignable_v<_T1&, _U1>)
582 return is_nothrow_assignable_v<_T2&, _U2>;
586 #if __glibcxx_tuple_like // >= C++23 587 template<
typename _UPair>
588 static constexpr
bool 589 _S_assignable_from_tuple_like()
591 return _S_assignable<decltype(std::get<0>(std::declval<_UPair>())),
592 decltype(std::get<1>(std::declval<_UPair>()))>();
595 template<
typename _UPair>
596 static constexpr
bool 597 _S_const_assignable_from_tuple_like()
599 return _S_const_assignable<decltype(std::get<0>(std::declval<_UPair>())),
600 decltype(std::get<1>(std::declval<_UPair>()))>();
607 pair& operator=(
const pair&) =
delete;
611 operator=(
const pair& __p)
612 noexcept(_S_nothrow_assignable<const _T1&, const _T2&>())
613 requires (_S_assignable<const _T1&, const _T2&>())
622 operator=(pair&& __p)
623 noexcept(_S_nothrow_assignable<_T1, _T2>())
624 requires (_S_assignable<_T1, _T2>())
626 first = std::forward<first_type>(__p.
first);
627 second = std::forward<second_type>(__p.
second);
632 template<
typename _U1,
typename _U2>
635 noexcept(_S_nothrow_assignable<const _U1&, const _U2&>())
636 requires (_S_assignable<const _U1&, const _U2&>())
644 template<
typename _U1,
typename _U2>
647 noexcept(_S_nothrow_assignable<_U1, _U2>())
648 requires (_S_assignable<_U1, _U2>())
650 first = std::forward<_U1>(__p.
first);
651 second = std::forward<_U2>(__p.
second);
655 #if __glibcxx_ranges_zip // >= C++23 657 constexpr
const pair&
658 operator=(
const pair& __p)
const 659 requires (_S_const_assignable<const first_type&, const second_type&>())
667 constexpr
const pair&
668 operator=(pair&& __p)
const 669 requires (_S_const_assignable<first_type, second_type>())
671 first = std::forward<first_type>(__p.
first);
672 second = std::forward<second_type>(__p.
second);
677 template<
typename _U1,
typename _U2>
678 constexpr
const pair&
680 requires (_S_const_assignable<const _U1&, const _U2&>())
688 template<
typename _U1,
typename _U2>
689 constexpr
const pair&
691 requires (_S_const_assignable<_U1, _U2>())
693 first = std::forward<_U1>(__p.
first);
694 second = std::forward<_U2>(__p.
second);
699 #if __glibcxx_tuple_like // >= C++23 700 template<__eligible_pair_like<pair> _UPair>
701 requires (_S_assignable_from_tuple_like<_UPair>())
703 operator=(_UPair&& __p)
705 first = std::get<0>(std::forward<_UPair>(__p));
706 second = std::get<1>(std::forward<_UPair>(__p));
710 template<__eligible_pair_like<pair> _UPair>
711 requires (_S_const_assignable_from_tuple_like<_UPair>())
712 constexpr
const pair&
713 operator=(_UPair&& __p)
const 715 first = std::get<0>(std::forward<_UPair>(__p));
716 second = std::get<1>(std::forward<_UPair>(__p));
721 #else // !__cpp_lib_concepts 726 #if __has_builtin(__reference_constructs_from_temporary) \ 727 && defined _GLIBCXX_DEBUG 728 # define __glibcxx_no_dangling_refs(_U1, _U2) \ 729 static_assert(!__reference_constructs_from_temporary(_T1, _U1) \ 730 && !__reference_constructs_from_temporary(_T2, _U2), \ 731 "std::pair constructor creates a dangling reference") 733 # define __glibcxx_no_dangling_refs(_U1, _U2) 739 template <
typename _U1 = _T1,
742 __is_implicitly_default_constructible<_U1>,
743 __is_implicitly_default_constructible<_U2>>
744 ::value,
bool>::type =
true>
746 : first(), second() { }
748 template <
typename _U1 = _T1,
754 __and_<__is_implicitly_default_constructible<_U1>,
755 __is_implicitly_default_constructible<_U2>>>>
756 ::value,
bool>::type =
false>
757 explicit constexpr pair()
758 : first(), second() { }
762 using _PCCP = _PCC<true, _T1, _T2>;
766 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 768 _ConstructiblePair<_U1, _U2>()
770 _ImplicitlyConvertiblePair<_U1, _U2>(),
772 constexpr pair(
const _T1& __a,
const _T2& __b)
773 : first(__a), second(__b) { }
776 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 778 _ConstructiblePair<_U1, _U2>()
780 _ImplicitlyConvertiblePair<_U1, _U2>(),
782 explicit constexpr pair(
const _T1& __a,
const _T2& __b)
783 : first(__a), second(__b) { }
787 template <
typename _U1,
typename _U2>
788 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
793 template<
typename _U1,
typename _U2,
typename 795 _ConstructiblePair<_U1, _U2>()
796 && _PCCFP<_U1, _U2>::template
797 _ImplicitlyConvertiblePair<_U1, _U2>(),
801 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
803 template<
typename _U1,
typename _U2,
typename 805 _ConstructiblePair<_U1, _U2>()
806 && !_PCCFP<_U1, _U2>::template
807 _ImplicitlyConvertiblePair<_U1, _U2>(),
811 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
813 #if _GLIBCXX_USE_DEPRECATED 814 #if defined(__DEPRECATED) 815 # define _GLIBCXX_DEPRECATED_PAIR_CTOR \ 816 __attribute__ ((__deprecated__ ("use 'nullptr' instead of '0' to " \ 817 "initialize std::pair of move-only " \ 818 "type and pointer"))) 820 # define _GLIBCXX_DEPRECATED_PAIR_CTOR 827 struct __zero_as_null_pointer_constant
829 __zero_as_null_pointer_constant(
int __zero_as_null_pointer_constant::*)
831 template<
typename _Tp,
832 typename = __enable_if_t<is_null_pointer<_Tp>::value>>
833 __zero_as_null_pointer_constant(_Tp) =
delete;
841 template<
typename _U1,
842 __enable_if_t<__and_<__not_<is_reference<_U1>>,
845 __not_<is_constructible<_T1, const _U1&>>,
846 is_convertible<_U1, _T1>>::value,
848 _GLIBCXX_DEPRECATED_PAIR_CTOR
850 pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
851 : first(std::forward<_U1>(__x)), second(
nullptr)
852 { __glibcxx_no_dangling_refs(_U1&&, std::nullptr_t); }
854 template<
typename _U1,
855 __enable_if_t<__and_<__not_<is_reference<_U1>>,
857 is_constructible<_T1, _U1>,
858 __not_<is_constructible<_T1, const _U1&>>,
859 __not_<is_convertible<_U1, _T1>>>::value,
861 _GLIBCXX_DEPRECATED_PAIR_CTOR
863 pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
864 : first(std::forward<_U1>(__x)), second(
nullptr)
865 { __glibcxx_no_dangling_refs(_U1&&, std::nullptr_t); }
867 template<
typename _U2,
868 __enable_if_t<__and_<is_pointer<_T1>,
869 __not_<is_reference<_U2>>,
871 __not_<is_constructible<_T2, const _U2&>>,
872 is_convertible<_U2, _T2>>::value,
874 _GLIBCXX_DEPRECATED_PAIR_CTOR
876 pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
877 : first(
nullptr), second(std::forward<_U2>(__y))
878 { __glibcxx_no_dangling_refs(std::nullptr_t, _U2&&); }
880 template<
typename _U2,
881 __enable_if_t<__and_<is_pointer<_T1>,
882 __not_<is_reference<_U2>>,
883 is_constructible<_T2, _U2>,
884 __not_<is_constructible<_T2, const _U2&>>,
885 __not_<is_convertible<_U2, _T2>>>::value,
887 _GLIBCXX_DEPRECATED_PAIR_CTOR
889 pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
890 : first(
nullptr), second(std::forward<_U2>(__y))
891 { __glibcxx_no_dangling_refs(std::nullptr_t, _U2&&); }
892 #undef _GLIBCXX_DEPRECATED_PAIR_CTOR 895 template<
typename _U1,
typename _U2,
typename 897 _MoveConstructiblePair<_U1, _U2>()
899 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
901 constexpr pair(_U1&& __x, _U2&& __y)
902 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y))
903 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
905 template<
typename _U1,
typename _U2,
typename 907 _MoveConstructiblePair<_U1, _U2>()
909 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
911 explicit constexpr pair(_U1&& __x, _U2&& __y)
912 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y))
913 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
916 template<
typename _U1,
typename _U2,
typename 918 _MoveConstructiblePair<_U1, _U2>()
919 && _PCCFP<_U1, _U2>::template
920 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
923 : first(std::forward<_U1>(__p.
first)),
924 second(std::forward<_U2>(__p.
second))
925 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
927 template<
typename _U1,
typename _U2,
typename 929 _MoveConstructiblePair<_U1, _U2>()
930 && !_PCCFP<_U1, _U2>::template
931 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
934 : first(std::forward<_U1>(__p.
first)),
935 second(std::forward<_U2>(__p.
second))
936 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
938 #undef __glibcxx_no_dangling_refs 943 const pair&,
const __nonesuch&> __p)
953 pair&&, __nonesuch&&> __p)
957 first = std::forward<first_type>(__p.
first);
958 second = std::forward<second_type>(__p.
second);
962 template<
typename _U1,
typename _U2>
973 template<
typename _U1,
typename _U2>
979 first = std::forward<_U1>(__p.
first);
980 second = std::forward<_U2>(__p.
second);
983 #endif // lib concepts 991 pair() : first(), second() { }
994 pair(
const _T1& __a,
const _T2& __b)
995 : first(__a), second(__b) { }
998 template<
typename _U1,
typename _U2>
1002 #if __has_builtin(__reference_constructs_from_temporary) 1003 #pragma GCC diagnostic push 1004 #pragma GCC diagnostic ignored "-Wunused-local-typedefs" 1005 typedef int _DanglingCheck1[
1006 __reference_constructs_from_temporary(_T1,
const _U1&) ? -1 : 1
1008 typedef int _DanglingCheck2[
1009 __reference_constructs_from_temporary(_T2,
const _U2&) ? -1 : 1
1011 #pragma GCC diagnostic pop 1019 #if __cpp_deduction_guides >= 201606 1023 #if __cpp_lib_three_way_comparison 1028 template<
typename _T1,
typename _T2,
typename _U1,
typename _U2>
1033 { __x.first == __y.first } -> __detail::__boolean_testable;
1034 { __x.second == __y.second } -> __detail::__boolean_testable;
1036 {
return __x.first == __y.first && __x.second == __y.second; }
1045 template<
typename _T1,
typename _T2,
typename _U1,
typename _U2>
1047 constexpr common_comparison_category_t<__detail::__synth3way_t<_T1, _U1>,
1048 __detail::__synth3way_t<_T2, _U2>>
1051 if (
auto __c = __detail::__synth3way(__x.
first, __y.
first); __c != 0)
1057 template<
typename _T1,
typename _T2>
1059 inline _GLIBCXX_CONSTEXPR
bool 1070 template<
typename _T1,
typename _T2>
1072 inline _GLIBCXX_CONSTEXPR
bool 1075 || (!(__y.
first < __x.first) && __x.second < __y.
second); }
1078 template<
typename _T1,
typename _T2>
1080 inline _GLIBCXX_CONSTEXPR
bool 1082 {
return !(__x == __y); }
1085 template<
typename _T1,
typename _T2>
1087 inline _GLIBCXX_CONSTEXPR
bool 1089 {
return __y < __x; }
1092 template<
typename _T1,
typename _T2>
1094 inline _GLIBCXX_CONSTEXPR
bool 1096 {
return !(__y < __x); }
1099 template<
typename _T1,
typename _T2>
1101 inline _GLIBCXX_CONSTEXPR
bool 1103 {
return !(__x < __y); }
1104 #endif // !(three_way_comparison && concepts) 1106 #if __cplusplus >= 201103L 1112 template<
typename _T1,
typename _T2>
1113 _GLIBCXX20_CONSTEXPR
inline 1114 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 1117 __is_swappable<_T2>>::value>::type
1122 noexcept(noexcept(__x.
swap(__y)))
1125 #if __glibcxx_ranges_zip // >= C++23 1126 template<
typename _T1,
typename _T2>
1127 requires is_swappable_v<const _T1> && is_swappable_v<const _T2>
1130 noexcept(noexcept(__x.
swap(__y)))
1134 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 1137 template<
typename _T1,
typename _T2>
1139 __is_swappable<_T2>>::value>::type
1142 #endif // __cplusplus >= 201103L 1161 #if __cplusplus >= 201103L 1163 template<
typename _T1,
typename _T2>
1165 typename __decay_and_strip<_T2>::__type>
1168 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
1169 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
1171 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
1174 template<
typename _T1,
typename _T2>
1176 make_pair(_T1 __x, _T2 __y)
1182 #if __cplusplus >= 201103L 1186 template<
typename _T1,
typename _T2>
1187 struct __is_tuple_like_impl<pair<_T1, _T2>> :
true_type 1192 template<
class _Tp1,
class _Tp2>
1197 template<
class _Tp1,
class _Tp2>
1199 {
typedef _Tp1 type; };
1202 template<
class _Tp1,
class _Tp2>
1204 {
typedef _Tp2 type; };
1206 #if __cplusplus >= 201703L 1207 template<
typename _Tp1,
typename _Tp2>
1208 inline constexpr
size_t tuple_size_v<pair<_Tp1, _Tp2>> = 2;
1210 template<
typename _Tp1,
typename _Tp2>
1211 inline constexpr
size_t tuple_size_v<const pair<_Tp1, _Tp2>> = 2;
1214 #if __cplusplus >= 201103L 1215 #pragma GCC diagnostic push 1216 #pragma GCC diagnostic ignored "-Wc++14-extensions" // variable templates 1217 #pragma GCC diagnostic ignored "-Wc++17-extensions" // inline variables 1218 template<
typename _Tp>
1219 inline constexpr
bool __is_pair =
false;
1221 template<
typename _Tp,
typename _Up>
1222 inline constexpr
bool __is_pair<pair<_Tp, _Up>> =
true;
1223 #pragma GCC diagnostic pop 1227 template<
size_t _Int>
1231 struct __pair_get<0>
1233 template<
typename _Tp1,
typename _Tp2>
1234 static constexpr _Tp1&
1236 {
return __pair.
first; }
1238 template<
typename _Tp1,
typename _Tp2>
1239 static constexpr _Tp1&&
1241 {
return std::forward<_Tp1>(__pair.
first); }
1243 template<
typename _Tp1,
typename _Tp2>
1244 static constexpr
const _Tp1&
1246 {
return __pair.
first; }
1248 template<
typename _Tp1,
typename _Tp2>
1249 static constexpr
const _Tp1&&
1251 {
return std::forward<const _Tp1>(__pair.
first); }
1255 struct __pair_get<1>
1257 template<
typename _Tp1,
typename _Tp2>
1258 static constexpr _Tp2&
1260 {
return __pair.
second; }
1262 template<
typename _Tp1,
typename _Tp2>
1263 static constexpr _Tp2&&
1265 {
return std::forward<_Tp2>(__pair.
second); }
1267 template<
typename _Tp1,
typename _Tp2>
1268 static constexpr
const _Tp2&
1270 {
return __pair.
second; }
1272 template<
typename _Tp1,
typename _Tp2>
1273 static constexpr
const _Tp2&&
1275 {
return std::forward<const _Tp2>(__pair.
second); }
1283 template<
size_t _Int,
class _Tp1,
class _Tp2>
1286 {
return __pair_get<_Int>::__get(__in); }
1288 template<
size_t _Int,
class _Tp1,
class _Tp2>
1291 {
return __pair_get<_Int>::__move_get(
std::move(__in)); }
1293 template<
size_t _Int,
class _Tp1,
class _Tp2>
1296 {
return __pair_get<_Int>::__const_get(__in); }
1298 template<
size_t _Int,
class _Tp1,
class _Tp2>
1301 {
return __pair_get<_Int>::__const_move_get(
std::move(__in)); }
1304 #ifdef __glibcxx_tuples_by_type // C++ >= 14 1305 template <
typename _Tp,
typename _Up>
1308 {
return __p.first; }
1310 template <
typename _Tp,
typename _Up>
1311 constexpr
const _Tp&
1313 {
return __p.first; }
1315 template <
typename _Tp,
typename _Up>
1318 {
return std::forward<_Tp>(__p.first); }
1320 template <
typename _Tp,
typename _Up>
1321 constexpr
const _Tp&&
1323 {
return std::forward<const _Tp>(__p.first); }
1325 template <
typename _Tp,
typename _Up>
1328 {
return __p.second; }
1330 template <
typename _Tp,
typename _Up>
1331 constexpr
const _Tp&
1333 {
return __p.second; }
1335 template <
typename _Tp,
typename _Up>
1338 {
return std::forward<_Tp>(__p.second); }
1340 template <
typename _Tp,
typename _Up>
1341 constexpr
const _Tp&&
1343 {
return std::forward<const _Tp>(__p.second); }
1344 #endif // __glibcxx_tuples_by_type 1347 #if __glibcxx_ranges_zip // >= C++23 1348 template<
typename _T1,
typename _T2,
typename _U1,
typename _U2,
1349 template<
typename>
class _TQual,
template<
typename>
class _UQual>
1352 struct basic_common_reference<pair<_T1, _T2>, pair<_U1, _U2>, _TQual, _UQual>
1358 template<
typename _T1,
typename _T2,
typename _U1,
typename _U2>
1360 struct common_type<pair<_T1, _T2>, pair<_U1, _U2>>
1367 _GLIBCXX_END_NAMESPACE_VERSION
Primary class template, tuple.
_T2 second_type
The type of the second member.
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
Gives the type of the ith element of a given tuple type.
ISO C++ entities toplevel namespace is std.
Struct holding two objects of arbitrary type.
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.
Finds the size of a given tuple type.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
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.
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)))
A standard container for storing a fixed size sequence of elements.
constexpr piecewise_construct_t piecewise_construct
Tag for piecewise construction of std::pair objects.
Tag type for piecewise construction of std::pair objects.
Define a member typedef type only if a boolean constant is true.
_T2 second
The second member.
constexpr bool operator==(const pair< _T1, _T2 > &__x, const pair< _U1, _U2 > &__y) requires requires
Two pairs are equal iff their members are equal.
_T1 first
The first member.
_T1 first_type
The type of the first member.
is_nothrow_move_assignable
typename common_reference< _Tp... >::type common_reference_t