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<
size_t _Int,
class _Tp1,
class _Tp2>
108 template<
size_t _Int,
class _Tp1,
class _Tp2>
112 template<
size_t _Int,
class _Tp1,
class _Tp2>
116 template<
size_t _Int,
class _Tp1,
class _Tp2>
120 template<
size_t __i,
typename... _Elements>
121 constexpr __tuple_element_t<__i,
tuple<_Elements...>>&
122 get(
tuple<_Elements...>& __t) noexcept;
124 template<
size_t __i,
typename... _Elements>
125 constexpr
const __tuple_element_t<__i,
tuple<_Elements...>>&
126 get(
const tuple<_Elements...>& __t) noexcept;
128 template<
size_t __i,
typename... _Elements>
129 constexpr __tuple_element_t<__i,
tuple<_Elements...>>&&
130 get(
tuple<_Elements...>&& __t) noexcept;
132 template<
size_t __i,
typename... _Elements>
133 constexpr
const __tuple_element_t<__i,
tuple<_Elements...>>&&
134 get(
const tuple<_Elements...>&& __t) noexcept;
136 template<
size_t _Int,
typename _Tp,
size_t _Nm>
140 template<
size_t _Int,
typename _Tp,
size_t _Nm>
144 template<
size_t _Int,
typename _Tp,
size_t _Nm>
148 template<
size_t _Int,
typename _Tp,
size_t _Nm>
149 constexpr
const _Tp&&
152 #if ! __cpp_lib_concepts 158 template <
bool,
typename _T1,
typename _T2>
161 template <
typename _U1,
typename _U2>
162 static constexpr
bool _ConstructiblePair()
164 return __and_<is_constructible<_T1, const _U1&>,
168 template <
typename _U1,
typename _U2>
169 static constexpr
bool _ImplicitlyConvertiblePair()
171 return __and_<is_convertible<const _U1&, _T1>,
175 template <
typename _U1,
typename _U2>
176 static constexpr
bool _MoveConstructiblePair()
178 return __and_<is_constructible<_T1, _U1&&>,
182 template <
typename _U1,
typename _U2>
183 static constexpr
bool _ImplicitlyMoveConvertiblePair()
185 return __and_<is_convertible<_U1&&, _T1>,
190 template <
typename _T1,
typename _T2>
191 struct _PCC<false, _T1, _T2>
193 template <
typename _U1,
typename _U2>
194 static constexpr
bool _ConstructiblePair()
199 template <
typename _U1,
typename _U2>
200 static constexpr
bool _ImplicitlyConvertiblePair()
205 template <
typename _U1,
typename _U2>
206 static constexpr
bool _MoveConstructiblePair()
211 template <
typename _U1,
typename _U2>
212 static constexpr
bool _ImplicitlyMoveConvertiblePair()
217 #endif // lib concepts 220 #if __glibcxx_tuple_like // >= C++23 221 template<
typename _Tp>
222 inline constexpr
bool __is_tuple_v =
false;
224 template<
typename... _Ts>
225 inline constexpr
bool __is_tuple_v<
tuple<_Ts...>> =
true;
228 template<
typename _Tp>
229 inline constexpr
bool __is_tuple_like_v =
false;
231 template<
typename... _Elements>
232 inline constexpr
bool __is_tuple_like_v<
tuple<_Elements...>> =
true;
234 template<
typename _T1,
typename _T2>
235 inline constexpr
bool __is_tuple_like_v<pair<_T1, _T2>> =
true;
237 template<
typename _Tp,
size_t _Nm>
238 inline constexpr
bool __is_tuple_like_v<array<_Tp, _Nm>> =
true;
242 template<
typename _Tp>
243 concept __tuple_like = __is_tuple_like_v<remove_cvref_t<_Tp>>;
245 template<
typename _Tp>
246 concept __pair_like = __tuple_like<_Tp> && tuple_size_v<remove_cvref_t<_Tp>> == 2;
248 template<
typename _Tp,
typename _Tuple>
249 concept __eligible_tuple_like
250 = __detail::__different_from<_Tp, _Tuple> && __tuple_like<_Tp>
251 && (tuple_size_v<remove_cvref_t<_Tp>> == tuple_size_v<_Tuple>)
252 && !ranges::__detail::__is_subrange<remove_cvref_t<_Tp>>;
254 template<
typename _Tp,
typename _Pair>
255 concept __eligible_pair_like
256 = __detail::__different_from<_Tp, _Pair> && __pair_like<_Tp>
257 && !ranges::__detail::__is_subrange<remove_cvref_t<_Tp>>;
260 template<
typename _U1,
typename _U2>
class __pair_base
262 #if __cplusplus >= 201103L && ! __cpp_lib_concepts 263 template<
typename _T1,
typename _T2>
friend struct pair;
264 __pair_base() =
default;
265 ~__pair_base() =
default;
266 __pair_base(
const __pair_base&) =
default;
267 __pair_base& operator=(
const __pair_base&) =
delete;
283 template<
typename _T1,
typename _T2>
285 :
public __pair_base<_T1, _T2>
293 #if __cplusplus >= 201103L 294 constexpr
pair(
const pair&) =
default;
297 template<
typename... _Args1,
typename... _Args2>
302 _GLIBCXX20_CONSTEXPR
void 304 noexcept(__and_<__is_nothrow_swappable<_T1>,
305 __is_nothrow_swappable<_T2>>::value)
308 swap(first, __p.first);
309 swap(second, __p.second);
312 #if __glibcxx_ranges_zip // >= C++23 320 swap(
const pair& __p)
const 321 noexcept(__and_v<__is_nothrow_swappable<const _T1>,
322 __is_nothrow_swappable<const _T2>>)
323 requires is_swappable_v<const _T1> && is_swappable_v<const _T2>
326 swap(first, __p.
first);
332 template<
typename... _Args1,
size_t... _Indexes1,
333 typename... _Args2,
size_t... _Indexes2>
336 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
339 #if __cpp_lib_concepts 344 explicit(__not_<__and_<__is_implicitly_default_constructible<_T1>,
345 __is_implicitly_default_constructible<_T2>>>())
347 requires is_default_constructible_v<_T1>
348 && is_default_constructible_v<_T2>
355 template<
typename _U1,
typename _U2>
356 static constexpr
bool 359 if constexpr (is_constructible_v<_T1, _U1>)
360 return is_constructible_v<_T2, _U2>;
364 template<
typename _U1,
typename _U2>
365 static constexpr
bool 366 _S_nothrow_constructible()
368 if constexpr (is_nothrow_constructible_v<_T1, _U1>)
369 return is_nothrow_constructible_v<_T2, _U2>;
373 template<
typename _U1,
typename _U2>
374 static constexpr
bool 377 if constexpr (is_convertible_v<_U1, _T1>)
378 return is_convertible_v<_U2, _T2>;
383 template<
typename _U1,
typename _U2>
384 static constexpr
bool 387 #if __has_builtin(__reference_constructs_from_temporary) 388 if constexpr (__reference_constructs_from_temporary(_T1, _U1&&))
391 return __reference_constructs_from_temporary(_T2, _U2&&);
397 #if __glibcxx_tuple_like // >= C++23 398 template<
typename _UPair>
399 static constexpr
bool 400 _S_constructible_from_pair_like()
402 return _S_constructible<decltype(std::get<0>(std::declval<_UPair>())),
403 decltype(std::get<1>(std::declval<_UPair>()))>();
406 template<
typename _UPair>
407 static constexpr
bool 408 _S_convertible_from_pair_like()
410 return _S_convertible<decltype(std::get<0>(std::declval<_UPair>())),
411 decltype(std::get<1>(std::declval<_UPair>()))>();
414 template<
typename _UPair>
415 static constexpr
bool 416 _S_dangles_from_pair_like()
418 return _S_dangles<decltype(std::get<0>(std::declval<_UPair>())),
419 decltype(std::get<1>(std::declval<_UPair>()))>();
427 constexpr
explicit(!_S_convertible<const _T1&, const _T2&>())
428 pair(
const type_identity_t<_T1>& __x,
const _T2& __y)
429 noexcept(_S_nothrow_constructible<const _T1&, const _T2&>())
430 requires (_S_constructible<const _T1&, const _T2&>())
431 : first(__x), second(__y)
435 #if __cplusplus > 202002L 436 template<
typename _U1 = _T1,
typename _U2 = _T2>
438 template<
typename _U1,
typename _U2>
440 requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>())
441 constexpr
explicit(!_S_convertible<_U1, _U2>())
442 pair(_U1&& __x, _U2&& __y)
443 noexcept(_S_nothrow_constructible<_U1, _U2>())
444 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y))
447 #if __cplusplus > 202002L 448 template<
typename _U1 = _T1,
typename _U2 = _T2>
450 template<
typename _U1,
typename _U2>
452 requires (_S_constructible<_U1, _U2>()) && (_S_dangles<_U1, _U2>())
453 constexpr
explicit(!_S_convertible<_U1, _U2>())
454 pair(_U1&&, _U2&&) =
delete;
457 template<
typename _U1,
typename _U2>
458 requires (_S_constructible<const _U1&, const _U2&>())
459 && (!_S_dangles<_U1, _U2>())
460 constexpr
explicit(!_S_convertible<const _U1&, const _U2&>())
462 noexcept(_S_nothrow_constructible<const _U1&, const _U2&>())
466 template<
typename _U1,
typename _U2>
467 requires (_S_constructible<const _U1&, const _U2&>())
468 && (_S_dangles<const _U1&, const _U2&>())
469 constexpr
explicit(!_S_convertible<const _U1&, const _U2&>())
473 template<
typename _U1,
typename _U2>
474 requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>())
475 constexpr
explicit(!_S_convertible<_U1, _U2>())
477 noexcept(_S_nothrow_constructible<_U1, _U2>())
478 : first(std::forward<_U1>(__p.
first)),
479 second(std::forward<_U2>(__p.
second))
482 template<
typename _U1,
typename _U2>
483 requires (_S_constructible<_U1, _U2>()) && (_S_dangles<_U1, _U2>())
484 constexpr
explicit(!_S_convertible<_U1, _U2>())
487 #if __glibcxx_ranges_zip // >= C++23 489 template<
typename _U1,
typename _U2>
490 requires (_S_constructible<_U1&, _U2&>()) && (!_S_dangles<_U1&, _U2&>())
491 constexpr
explicit(!_S_convertible<_U1&, _U2&>())
493 noexcept(_S_nothrow_constructible<_U1&, _U2&>())
497 template<
typename _U1,
typename _U2>
498 requires (_S_constructible<_U1&, _U2&>()) && (_S_dangles<_U1&, _U2&>())
499 constexpr
explicit(!_S_convertible<_U1&, _U2&>())
503 template<
typename _U1,
typename _U2>
504 requires (_S_constructible<const _U1, const _U2>())
505 && (!_S_dangles<const _U1, const _U2>())
506 constexpr
explicit(!_S_convertible<const _U1, const _U2>())
508 noexcept(_S_nothrow_constructible<const _U1, const _U2>())
509 : first(std::forward<const _U1>(__p.
first)),
510 second(std::forward<const _U2>(__p.
second))
513 template<
typename _U1,
typename _U2>
514 requires (_S_constructible<const _U1, const _U2>())
515 && (_S_dangles<const _U1, const _U2>())
516 constexpr
explicit(!_S_convertible<const _U1, const _U2>())
520 #if __glibcxx_tuple_like // >= C++23 521 template<__eligible_pair_like<pair> _UPair>
522 requires (_S_constructible_from_pair_like<_UPair>())
523 && (!_S_dangles_from_pair_like<_UPair>())
524 constexpr
explicit(!_S_convertible_from_pair_like<_UPair>())
526 : first(std::get<0>(std::forward<_UPair>(__p))),
527 second(std::get<1>(std::forward<_UPair>(__p)))
530 template<__eligible_pair_like<pair> _UPair>
531 requires (_S_constructible_from_pair_like<_UPair>())
532 && (_S_dangles_from_pair_like<_UPair>())
533 constexpr
explicit(!_S_convertible_from_pair_like<_UPair>())
534 pair(_UPair&&) =
delete;
539 template<
typename _U1,
typename _U2>
540 static constexpr
bool 543 if constexpr (is_assignable_v<_T1&, _U1>)
544 return is_assignable_v<_T2&, _U2>;
548 template<
typename _U1,
typename _U2>
549 static constexpr
bool 550 _S_const_assignable()
552 if constexpr (is_assignable_v<const _T1&, _U1>)
553 return is_assignable_v<const _T2&, _U2>;
557 template<
typename _U1,
typename _U2>
558 static constexpr
bool 559 _S_nothrow_assignable()
561 if constexpr (is_nothrow_assignable_v<_T1&, _U1>)
562 return is_nothrow_assignable_v<_T2&, _U2>;
566 #if __glibcxx_tuple_like // >= C++23 567 template<
typename _UPair>
568 static constexpr
bool 569 _S_assignable_from_tuple_like()
571 return _S_assignable<decltype(std::get<0>(std::declval<_UPair>())),
572 decltype(std::get<1>(std::declval<_UPair>()))>();
575 template<
typename _UPair>
576 static constexpr
bool 577 _S_const_assignable_from_tuple_like()
579 return _S_const_assignable<decltype(std::get<0>(std::declval<_UPair>())),
580 decltype(std::get<1>(std::declval<_UPair>()))>();
587 pair& operator=(
const pair&) =
delete;
591 operator=(
const pair& __p)
592 noexcept(_S_nothrow_assignable<const _T1&, const _T2&>())
593 requires (_S_assignable<const _T1&, const _T2&>())
602 operator=(pair&& __p)
603 noexcept(_S_nothrow_assignable<_T1, _T2>())
604 requires (_S_assignable<_T1, _T2>())
606 first = std::forward<first_type>(__p.
first);
607 second = std::forward<second_type>(__p.
second);
612 template<
typename _U1,
typename _U2>
615 noexcept(_S_nothrow_assignable<const _U1&, const _U2&>())
616 requires (_S_assignable<const _U1&, const _U2&>())
624 template<
typename _U1,
typename _U2>
627 noexcept(_S_nothrow_assignable<_U1, _U2>())
628 requires (_S_assignable<_U1, _U2>())
630 first = std::forward<_U1>(__p.
first);
631 second = std::forward<_U2>(__p.
second);
635 #if __glibcxx_ranges_zip // >= C++23 637 constexpr
const pair&
638 operator=(
const pair& __p)
const 639 requires (_S_const_assignable<const first_type&, const second_type&>())
647 constexpr
const pair&
648 operator=(pair&& __p)
const 649 requires (_S_const_assignable<first_type, second_type>())
651 first = std::forward<first_type>(__p.
first);
652 second = std::forward<second_type>(__p.
second);
657 template<
typename _U1,
typename _U2>
658 constexpr
const pair&
660 requires (_S_const_assignable<const _U1&, const _U2&>())
668 template<
typename _U1,
typename _U2>
669 constexpr
const pair&
671 requires (_S_const_assignable<_U1, _U2>())
673 first = std::forward<_U1>(__p.
first);
674 second = std::forward<_U2>(__p.
second);
679 #if __glibcxx_tuple_like // >= C++23 680 template<__eligible_pair_like<pair> _UPair>
681 requires (_S_assignable_from_tuple_like<_UPair>())
683 operator=(_UPair&& __p)
685 first = std::get<0>(std::forward<_UPair>(__p));
686 second = std::get<1>(std::forward<_UPair>(__p));
690 template<__eligible_pair_like<pair> _UPair>
691 requires (_S_const_assignable_from_tuple_like<_UPair>())
692 constexpr
const pair&
693 operator=(_UPair&& __p)
const 695 first = std::get<0>(std::forward<_UPair>(__p));
696 second = std::get<1>(std::forward<_UPair>(__p));
701 #else // !__cpp_lib_concepts 706 #if __has_builtin(__reference_constructs_from_temporary) \ 707 && defined _GLIBCXX_DEBUG 708 # define __glibcxx_no_dangling_refs(_U1, _U2) \ 709 static_assert(!__reference_constructs_from_temporary(_T1, _U1) \ 710 && !__reference_constructs_from_temporary(_T2, _U2), \ 711 "std::pair constructor creates a dangling reference") 713 # define __glibcxx_no_dangling_refs(_U1, _U2) 719 template <
typename _U1 = _T1,
722 __is_implicitly_default_constructible<_U1>,
723 __is_implicitly_default_constructible<_U2>>
724 ::value,
bool>::type =
true>
726 : first(), second() { }
728 template <
typename _U1 = _T1,
734 __and_<__is_implicitly_default_constructible<_U1>,
735 __is_implicitly_default_constructible<_U2>>>>
736 ::value,
bool>::type =
false>
737 explicit constexpr pair()
738 : first(), second() { }
742 using _PCCP = _PCC<true, _T1, _T2>;
746 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 748 _ConstructiblePair<_U1, _U2>()
750 _ImplicitlyConvertiblePair<_U1, _U2>(),
752 constexpr
pair(
const _T1& __a,
const _T2& __b)
753 : first(__a), second(__b) { }
756 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 758 _ConstructiblePair<_U1, _U2>()
760 _ImplicitlyConvertiblePair<_U1, _U2>(),
762 explicit constexpr
pair(
const _T1& __a,
const _T2& __b)
763 : first(__a), second(__b) { }
767 template <
typename _U1,
typename _U2>
768 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
773 template<
typename _U1,
typename _U2,
typename 775 _ConstructiblePair<_U1, _U2>()
776 && _PCCFP<_U1, _U2>::template
777 _ImplicitlyConvertiblePair<_U1, _U2>(),
781 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
783 template<
typename _U1,
typename _U2,
typename 785 _ConstructiblePair<_U1, _U2>()
786 && !_PCCFP<_U1, _U2>::template
787 _ImplicitlyConvertiblePair<_U1, _U2>(),
791 { __glibcxx_no_dangling_refs(
const _U1&,
const _U2&); }
793 #if _GLIBCXX_USE_DEPRECATED 794 #if defined(__DEPRECATED) 795 # define _GLIBCXX_DEPRECATED_PAIR_CTOR \ 796 __attribute__ ((__deprecated__ ("use 'nullptr' instead of '0' to " \ 797 "initialize std::pair of move-only " \ 798 "type and pointer"))) 800 # define _GLIBCXX_DEPRECATED_PAIR_CTOR 807 struct __zero_as_null_pointer_constant
809 __zero_as_null_pointer_constant(
int __zero_as_null_pointer_constant::*)
811 template<
typename _Tp,
812 typename = __enable_if_t<is_null_pointer<_Tp>::value>>
813 __zero_as_null_pointer_constant(_Tp) =
delete;
821 template<
typename _U1,
822 __enable_if_t<__and_<__not_<is_reference<_U1>>,
825 __not_<is_constructible<_T1, const _U1&>>,
828 _GLIBCXX_DEPRECATED_PAIR_CTOR
830 pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
831 : first(std::forward<_U1>(__x)), second(
nullptr)
832 { __glibcxx_no_dangling_refs(_U1&&, std::nullptr_t); }
834 template<
typename _U1,
835 __enable_if_t<__and_<__not_<is_reference<_U1>>,
837 is_constructible<_T1, _U1>,
838 __not_<is_constructible<_T1, const _U1&>>,
839 __not_<is_convertible<_U1, _T1>>>::value,
841 _GLIBCXX_DEPRECATED_PAIR_CTOR
843 pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
844 : first(std::forward<_U1>(__x)), second(
nullptr)
845 { __glibcxx_no_dangling_refs(_U1&&, std::nullptr_t); }
847 template<
typename _U2,
848 __enable_if_t<__and_<is_pointer<_T1>,
849 __not_<is_reference<_U2>>,
851 __not_<is_constructible<_T2, const _U2&>>,
854 _GLIBCXX_DEPRECATED_PAIR_CTOR
856 pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
857 : first(
nullptr), second(std::forward<_U2>(__y))
858 { __glibcxx_no_dangling_refs(std::nullptr_t, _U2&&); }
860 template<
typename _U2,
861 __enable_if_t<__and_<is_pointer<_T1>,
862 __not_<is_reference<_U2>>,
863 is_constructible<_T2, _U2>,
864 __not_<is_constructible<_T2, const _U2&>>,
865 __not_<is_convertible<_U2, _T2>>>::value,
867 _GLIBCXX_DEPRECATED_PAIR_CTOR
869 pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
870 : first(
nullptr), second(std::forward<_U2>(__y))
871 { __glibcxx_no_dangling_refs(std::nullptr_t, _U2&&); }
872 #undef _GLIBCXX_DEPRECATED_PAIR_CTOR 875 template<
typename _U1,
typename _U2,
typename 877 _MoveConstructiblePair<_U1, _U2>()
879 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
881 constexpr pair(_U1&& __x, _U2&& __y)
882 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y))
883 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
885 template<
typename _U1,
typename _U2,
typename 887 _MoveConstructiblePair<_U1, _U2>()
889 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
891 explicit constexpr pair(_U1&& __x, _U2&& __y)
892 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y))
893 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
896 template<
typename _U1,
typename _U2,
typename 898 _MoveConstructiblePair<_U1, _U2>()
899 && _PCCFP<_U1, _U2>::template
900 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
903 : first(std::forward<_U1>(__p.
first)),
904 second(std::forward<_U2>(__p.
second))
905 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
907 template<
typename _U1,
typename _U2,
typename 909 _MoveConstructiblePair<_U1, _U2>()
910 && !_PCCFP<_U1, _U2>::template
911 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
914 : first(std::forward<_U1>(__p.
first)),
915 second(std::forward<_U2>(__p.
second))
916 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
918 #undef __glibcxx_no_dangling_refs 923 const pair&,
const __nonesuch&> __p)
933 pair&&, __nonesuch&&> __p)
937 first = std::forward<first_type>(__p.
first);
938 second = std::forward<second_type>(__p.
second);
942 template<
typename _U1,
typename _U2>
953 template<
typename _U1,
typename _U2>
959 first = std::forward<_U1>(__p.
first);
960 second = std::forward<_U2>(__p.
second);
963 #endif // lib concepts 971 pair() : first(), second() { }
974 pair(
const _T1& __a,
const _T2& __b)
975 : first(__a), second(__b) { }
978 template<
typename _U1,
typename _U2>
982 #if __has_builtin(__reference_constructs_from_temporary) 983 #pragma GCC diagnostic push 984 #pragma GCC diagnostic ignored "-Wunused-local-typedefs" 985 typedef int _DanglingCheck1[
986 __reference_constructs_from_temporary(_T1,
const _U1&) ? -1 : 1
988 typedef int _DanglingCheck2[
989 __reference_constructs_from_temporary(_T2,
const _U2&) ? -1 : 1
991 #pragma GCC diagnostic pop 999 #if __cpp_deduction_guides >= 201606 1003 #if __cpp_lib_three_way_comparison && __cpp_lib_concepts 1008 template<
typename _T1,
typename _T2,
typename _U1,
typename _U2>
1009 inline _GLIBCXX_CONSTEXPR
bool 1020 template<
typename _T1,
typename _T2,
typename _U1,
typename _U2>
1021 constexpr common_comparison_category_t<__detail::__synth3way_t<_T1, _U1>,
1022 __detail::__synth3way_t<_T2, _U2>>
1025 if (
auto __c = __detail::__synth3way(__x.
first, __y.
first); __c != 0)
1031 template<
typename _T1,
typename _T2>
1032 inline _GLIBCXX_CONSTEXPR
bool 1043 template<
typename _T1,
typename _T2>
1044 inline _GLIBCXX_CONSTEXPR
bool 1047 || (!(__y.
first < __x.first) && __x.second < __y.
second); }
1050 template<
typename _T1,
typename _T2>
1051 inline _GLIBCXX_CONSTEXPR
bool 1053 {
return !(__x == __y); }
1056 template<
typename _T1,
typename _T2>
1057 inline _GLIBCXX_CONSTEXPR
bool 1059 {
return __y < __x; }
1062 template<
typename _T1,
typename _T2>
1063 inline _GLIBCXX_CONSTEXPR
bool 1065 {
return !(__y < __x); }
1068 template<
typename _T1,
typename _T2>
1069 inline _GLIBCXX_CONSTEXPR
bool 1071 {
return !(__x < __y); }
1072 #endif // !(three_way_comparison && concepts) 1074 #if __cplusplus >= 201103L 1080 template<
typename _T1,
typename _T2>
1081 _GLIBCXX20_CONSTEXPR
inline 1082 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 1085 __is_swappable<_T2>>::value>::type
1090 noexcept(noexcept(__x.swap(__y)))
1093 #if __glibcxx_ranges_zip // >= C++23 1094 template<
typename _T1,
typename _T2>
1095 requires is_swappable_v<const _T1> && is_swappable_v<const _T2>
1098 noexcept(noexcept(__x.
swap(__y)))
1102 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 1103 template<
typename _T1,
typename _T2>
1105 __is_swappable<_T2>>::value>::type
1108 #endif // __cplusplus >= 201103L 1127 #if __cplusplus >= 201103L 1129 template<
typename _T1,
typename _T2>
1131 typename __decay_and_strip<_T2>::__type>
1134 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
1135 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
1137 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
1140 template<
typename _T1,
typename _T2>
1142 make_pair(_T1 __x, _T2 __y)
1148 #if __cplusplus >= 201103L 1152 template<
typename _T1,
typename _T2>
1153 struct __is_tuple_like_impl<pair<_T1, _T2>> :
true_type 1158 template<
class _Tp1,
class _Tp2>
1163 template<
class _Tp1,
class _Tp2>
1165 {
typedef _Tp1 type; };
1168 template<
class _Tp1,
class _Tp2>
1170 {
typedef _Tp2 type; };
1174 template<
size_t __i,
typename... _Types>
1177 #if __cplusplus >= 201703L 1178 template<
typename _Tp1,
typename _Tp2>
1179 inline constexpr
size_t tuple_size_v<pair<_Tp1, _Tp2>> = 2;
1181 template<
typename _Tp1,
typename _Tp2>
1182 inline constexpr
size_t tuple_size_v<const pair<_Tp1, _Tp2>> = 2;
1185 #if __cplusplus >= 201103L 1186 #pragma GCC diagnostic push 1187 #pragma GCC diagnostic ignored "-Wc++14-extensions" // variable templates 1188 #pragma GCC diagnostic ignored "-Wc++17-extensions" // inline variables 1189 template<
typename _Tp>
1190 inline constexpr
bool __is_pair =
false;
1192 template<
typename _Tp,
typename _Up>
1193 inline constexpr
bool __is_pair<pair<_Tp, _Up>> =
true;
1194 #pragma GCC diagnostic pop 1198 template<
size_t _Int>
1202 struct __pair_get<0>
1204 template<
typename _Tp1,
typename _Tp2>
1205 static constexpr _Tp1&
1207 {
return __pair.
first; }
1209 template<
typename _Tp1,
typename _Tp2>
1210 static constexpr _Tp1&&
1212 {
return std::forward<_Tp1>(__pair.
first); }
1214 template<
typename _Tp1,
typename _Tp2>
1215 static constexpr
const _Tp1&
1217 {
return __pair.
first; }
1219 template<
typename _Tp1,
typename _Tp2>
1220 static constexpr
const _Tp1&&
1222 {
return std::forward<const _Tp1>(__pair.
first); }
1226 struct __pair_get<1>
1228 template<
typename _Tp1,
typename _Tp2>
1229 static constexpr _Tp2&
1231 {
return __pair.
second; }
1233 template<
typename _Tp1,
typename _Tp2>
1234 static constexpr _Tp2&&
1236 {
return std::forward<_Tp2>(__pair.
second); }
1238 template<
typename _Tp1,
typename _Tp2>
1239 static constexpr
const _Tp2&
1241 {
return __pair.
second; }
1243 template<
typename _Tp1,
typename _Tp2>
1244 static constexpr
const _Tp2&&
1246 {
return std::forward<const _Tp2>(__pair.
second); }
1254 template<
size_t _Int,
class _Tp1,
class _Tp2>
1257 {
return __pair_get<_Int>::__get(__in); }
1259 template<
size_t _Int,
class _Tp1,
class _Tp2>
1262 {
return __pair_get<_Int>::__move_get(
std::move(__in)); }
1264 template<
size_t _Int,
class _Tp1,
class _Tp2>
1267 {
return __pair_get<_Int>::__const_get(__in); }
1269 template<
size_t _Int,
class _Tp1,
class _Tp2>
1272 {
return __pair_get<_Int>::__const_move_get(
std::move(__in)); }
1275 #ifdef __glibcxx_tuples_by_type // C++ >= 14 1276 template <
typename _Tp,
typename _Up>
1279 {
return __p.first; }
1281 template <
typename _Tp,
typename _Up>
1282 constexpr
const _Tp&
1284 {
return __p.first; }
1286 template <
typename _Tp,
typename _Up>
1289 {
return std::forward<_Tp>(__p.first); }
1291 template <
typename _Tp,
typename _Up>
1292 constexpr
const _Tp&&
1294 {
return std::forward<const _Tp>(__p.first); }
1296 template <
typename _Tp,
typename _Up>
1299 {
return __p.second; }
1301 template <
typename _Tp,
typename _Up>
1302 constexpr
const _Tp&
1304 {
return __p.second; }
1306 template <
typename _Tp,
typename _Up>
1309 {
return std::forward<_Tp>(__p.second); }
1311 template <
typename _Tp,
typename _Up>
1312 constexpr
const _Tp&&
1314 {
return std::forward<const _Tp>(__p.second); }
1315 #endif // __glibcxx_tuples_by_type 1318 #if __glibcxx_ranges_zip // >= C++23 1319 template<
typename _T1,
typename _T2,
typename _U1,
typename _U2,
1320 template<
typename>
class _TQual,
template<
typename>
class _UQual>
1323 struct basic_common_reference<pair<_T1, _T2>, pair<_U1, _U2>, _TQual, _UQual>
1329 template<
typename _T1,
typename _T2,
typename _U1,
typename _U2>
1331 struct common_type<pair<_T1, _T2>, pair<_U1, _U2>>
1338 _GLIBCXX_END_NAMESPACE_VERSION
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 std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
Finds the size of a given tuple type.
is_nothrow_move_assignable
constexpr bool operator>=(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Uses operator< to find the result.
A standard container for storing a fixed size sequence of elements.
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.
_T2 second
The second member.
ISO C++ entities toplevel namespace is std.
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
constexpr bool operator>(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Uses operator< to find the result.
_T2 second_type
The type of the second member.
_T1 first
The first member.
_T1 first_type
The type of the first member.
Define a member typedef type only if a boolean constant is true.
constexpr bool operator!=(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Uses operator== to find the result.
constexpr pair(const _T1 &__a, const _T2 &__b)
Construct from two const lvalues, allowing implicit conversions.
typename common_type< _Tp... >::type common_type_t
Alias template for common_type.
constexpr piecewise_construct_t piecewise_construct
Tag for piecewise construction of std::pair objects.
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.
Primary class template, tuple.
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)))
Gives the type of the ith element of a given tuple type.
Struct holding two objects of arbitrary type.
typename common_reference< _Tp... >::type common_reference_t
Tag type for piecewise construction of std::pair objects.