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...>>&
124 template<
size_t __i,
typename... _Elements>
125 constexpr
const __tuple_element_t<__i,
tuple<_Elements...>>&
128 template<
size_t __i,
typename... _Elements>
129 constexpr __tuple_element_t<__i,
tuple<_Elements...>>&&
132 template<
size_t __i,
typename... _Elements>
133 constexpr
const __tuple_element_t<__i,
tuple<_Elements...>>&&
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>
146 get(const
array<_Tp, _Nm>&) noexcept;
148 template<
size_t _Int, typename _Tp,
size_t _Nm>
149 constexpr const _Tp&&
150 get(const
array<_Tp, _Nm>&&) noexcept;
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>,
172 is_convertible<const _U2&, _T2>>::value;
175 template <
typename _U1,
typename _U2>
176 static constexpr
bool _MoveConstructiblePair()
178 return __and_<is_constructible<_T1, _U1&&>,
179 is_constructible<_T2, _U2&&>>::value;
182 template <
typename _U1,
typename _U2>
183 static constexpr
bool _ImplicitlyMoveConvertiblePair()
185 return __and_<is_convertible<_U1&&, _T1>,
186 is_convertible<_U2&&, _T2>>::value;
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()
220 #if __glibcxx_tuple_like
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
297 template<
typename... _Args1,
typename... _Args2>
302 _GLIBCXX20_CONSTEXPR
void
304 noexcept(__and_<__is_nothrow_swappable<_T1>,
305 __is_nothrow_swappable<_T2>>::value)
312 #if __glibcxx_ranges_zip
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>
332 template<
typename... _Args1,
size_t... _Indexes1,
333 typename... _Args2,
size_t... _Indexes2>
335 pair(tuple<_Args1...>&, tuple<_Args2...>&,
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
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 _T1& __x,
const _T2& __y)
429 noexcept(_S_nothrow_constructible<const _T1&, const _T2&>())
430 requires (_S_constructible<const _T1&, const _T2&>())
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>())
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&>())
461 pair(
const pair<_U1, _U2>& __p)
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&>())
470 pair(
const pair<_U1, _U2>&) =
delete;
473 template<
typename _U1,
typename _U2>
474 requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>())
475 constexpr
explicit(!_S_convertible<_U1, _U2>())
476 pair(pair<_U1, _U2>&& __p)
477 noexcept(_S_nothrow_constructible<_U1, _U2>())
482 template<
typename _U1,
typename _U2>
483 requires (_S_constructible<_U1, _U2>()) && (_S_dangles<_U1, _U2>())
484 constexpr
explicit(!_S_convertible<_U1, _U2>())
485 pair(pair<_U1, _U2>&&) =
delete;
487 #if __glibcxx_ranges_zip
489 template<typename _U1, typename _U2>
490 requires (_S_constructible<_U1&, _U2&>()) && (!_S_dangles<_U1&, _U2&>())
491 constexpr
explicit(!_S_convertible<_U1&, _U2&>())
492 pair(pair<_U1, _U2>& __p)
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&>())
500 pair(pair<_U1, _U2>&) =
delete;
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>())
507 pair(
const pair<_U1, _U2>&& __p)
508 noexcept(_S_nothrow_constructible<const _U1, const _U2>())
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>())
517 pair(
const pair<_U1, _U2>&&) =
delete;
520 #if __glibcxx_tuple_like
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
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>
614 operator=(
const pair<_U1, _U2>& __p)
615 noexcept(_S_nothrow_assignable<const _U1&, const _U2&>())
616 requires (_S_assignable<const _U1&, const _U2&>())
624 template<
typename _U1,
typename _U2>
626 operator=(pair<_U1, _U2>&& __p)
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
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&
659 operator=(
const pair<_U1, _U2>& __p)
const
660 requires (_S_const_assignable<const _U1&, const _U2&>())
668 template<
typename _U1,
typename _U2>
669 constexpr
const pair&
670 operator=(pair<_U1, _U2>&& __p)
const
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
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));
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,
721 typename enable_if<__and_<
722 __is_implicitly_default_constructible<_U1>,
723 __is_implicitly_default_constructible<_U2>>
724 ::value,
bool>::type =
true>
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()
742 using _PCCP = _PCC<true, _T1, _T2>;
746 template<
typename _U1 = _T1,
typename _U2=_T2,
typename
747 enable_if<_PCCP::template
748 _ConstructiblePair<_U1, _U2>()
750 _ImplicitlyConvertiblePair<_U1, _U2>(),
752 constexpr
pair(
const _T1& __a,
const _T2& __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)
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
784 enable_if<_PCCFP<_U1, _U2>::template
785 _ConstructiblePair<_U1, _U2>()
786 && !_PCCFP<_U1, _U2>::template
787 _ImplicitlyConvertiblePair<_U1, _U2>(),
789 explicit constexpr
pair(
const pair<_U1, _U2>& __p)
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>>,
824 is_constructible<_T1, _U1>,
825 __not_<is_constructible<_T1, const _U1&>>,
826 is_convertible<_U1, _T1>>::value,
828 _GLIBCXX_DEPRECATED_PAIR_CTOR
830 pair(_U1&& __x, __zero_as_null_pointer_constant, ...)
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, ...)
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>>,
850 is_constructible<_T2, _U2>,
851 __not_<is_constructible<_T2, const _U2&>>,
852 is_convertible<_U2, _T2>>::value,
854 _GLIBCXX_DEPRECATED_PAIR_CTOR
856 pair(__zero_as_null_pointer_constant, _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, ...)
871 { __glibcxx_no_dangling_refs(std::nullptr_t, _U2&&); }
872 #undef _GLIBCXX_DEPRECATED_PAIR_CTOR
875 template<
typename _U1,
typename _U2,
typename
876 enable_if<_PCCP::template
877 _MoveConstructiblePair<_U1, _U2>()
879 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
881 constexpr
pair(_U1&& __x, _U2&& __y)
883 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
885 template<
typename _U1,
typename _U2,
typename
886 enable_if<_PCCP::template
887 _MoveConstructiblePair<_U1, _U2>()
889 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
891 explicit constexpr
pair(_U1&& __x, _U2&& __y)
893 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
896 template<
typename _U1,
typename _U2,
typename
897 enable_if<_PCCFP<_U1, _U2>::template
898 _MoveConstructiblePair<_U1, _U2>()
899 && _PCCFP<_U1, _U2>::template
900 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
902 constexpr
pair(pair<_U1, _U2>&& __p)
905 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
907 template<
typename _U1,
typename _U2,
typename
908 enable_if<_PCCFP<_U1, _U2>::template
909 _MoveConstructiblePair<_U1, _U2>()
910 && !_PCCFP<_U1, _U2>::template
911 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
913 explicit constexpr
pair(pair<_U1, _U2>&& __p)
916 { __glibcxx_no_dangling_refs(_U1&&, _U2&&); }
918 #undef __glibcxx_no_dangling_refs
921 operator=(__conditional_t<__and_<is_copy_assignable<_T1>,
922 is_copy_assignable<_T2>>::value,
923 const pair&,
const __nonesuch&> __p)
931 operator=(__conditional_t<__and_<is_move_assignable<_T1>,
932 is_move_assignable<_T2>>::value,
933 pair&&, __nonesuch&&> __p)
934 noexcept(__and_<is_nothrow_move_assignable<_T1>,
935 is_nothrow_move_assignable<_T2>>::value)
937 first = std::forward<first_type>(__p.first);
938 second = std::forward<second_type>(__p.second);
942 template<
typename _U1,
typename _U2>
943 typename enable_if<__and_<is_assignable<_T1&, const _U1&>,
944 is_assignable<_T2&, const _U2&>>::value,
946 operator=(
const pair<_U1, _U2>& __p)
953 template<
typename _U1,
typename _U2>
954 typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
955 is_assignable<_T2&, _U2&&>>::value,
957 operator=(pair<_U1, _U2>&& __p)
959 first = std::forward<_U1>(__p.first);
960 second = std::forward<_U2>(__p.second);
974 pair(
const _T1& __a,
const _T2& __b)
978 template<
typename _U1,
typename _U2>
979 pair(
const pair<_U1, _U2>& __p)
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
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); }
1074 #if __cplusplus >= 201103L
1080 template<
typename _T1,
typename _T2>
1081 _GLIBCXX20_CONSTEXPR
inline
1082 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
1085 __is_swappable<_T2>>::value>::type
1090 noexcept(noexcept(__x.
swap(__y)))
1093 #if __glibcxx_ranges_zip
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__)
1103 template<
typename _T1,
typename _T2>
1104 typename enable_if<!__and_<__is_swappable<_T1>,
1105 __is_swappable<_T2>>::value>::type
1106 swap(pair<_T1, _T2>&, pair<_T1, _T2>&) =
delete;
1127 #if __cplusplus >= 201103L
1129 template<
typename _T1,
typename _T2>
1130 constexpr pair<typename __decay_and_strip<_T1>::__type,
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;
1184 template<
typename _Tp>
1185 inline constexpr
bool __is_pair =
false;
1187 template<
typename _Tp,
typename _Up>
1188 inline constexpr
bool __is_pair<pair<_Tp, _Up>> =
true;
1192 template<
size_t _Int>
1196 struct __pair_get<0>
1198 template<
typename _Tp1,
typename _Tp2>
1199 static constexpr _Tp1&
1201 {
return __pair.first; }
1203 template<
typename _Tp1,
typename _Tp2>
1204 static constexpr _Tp1&&
1205 __move_get(pair<_Tp1, _Tp2>&& __pair) noexcept
1206 {
return std::forward<_Tp1>(__pair.first); }
1208 template<
typename _Tp1,
typename _Tp2>
1209 static constexpr
const _Tp1&
1210 __const_get(
const pair<_Tp1, _Tp2>& __pair) noexcept
1211 {
return __pair.first; }
1213 template<
typename _Tp1,
typename _Tp2>
1214 static constexpr
const _Tp1&&
1215 __const_move_get(
const pair<_Tp1, _Tp2>&& __pair) noexcept
1216 {
return std::forward<const _Tp1>(__pair.first); }
1220 struct __pair_get<1>
1222 template<
typename _Tp1,
typename _Tp2>
1223 static constexpr _Tp2&
1224 __get(pair<_Tp1, _Tp2>& __pair) noexcept
1225 {
return __pair.second; }
1227 template<
typename _Tp1,
typename _Tp2>
1228 static constexpr _Tp2&&
1229 __move_get(pair<_Tp1, _Tp2>&& __pair) noexcept
1230 {
return std::forward<_Tp2>(__pair.second); }
1232 template<
typename _Tp1,
typename _Tp2>
1233 static constexpr
const _Tp2&
1234 __const_get(
const pair<_Tp1, _Tp2>& __pair) noexcept
1235 {
return __pair.second; }
1237 template<
typename _Tp1,
typename _Tp2>
1238 static constexpr
const _Tp2&&
1239 __const_move_get(
const pair<_Tp1, _Tp2>&& __pair) noexcept
1240 {
return std::forward<const _Tp2>(__pair.second); }
1248 template<
size_t _Int,
class _Tp1,
class _Tp2>
1249 constexpr
typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type&
1251 {
return __pair_get<_Int>::__get(__in); }
1253 template<
size_t _Int,
class _Tp1,
class _Tp2>
1254 constexpr
typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type&&
1256 {
return __pair_get<_Int>::__move_get(
std::move(__in)); }
1258 template<
size_t _Int,
class _Tp1,
class _Tp2>
1259 constexpr
const typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type&
1261 {
return __pair_get<_Int>::__const_get(__in); }
1263 template<
size_t _Int,
class _Tp1,
class _Tp2>
1264 constexpr
const typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type&&
1266 {
return __pair_get<_Int>::__const_move_get(
std::move(__in)); }
1269 #ifdef __glibcxx_tuples_by_type
1270 template <
typename _Tp,
typename _Up>
1273 {
return __p.first; }
1275 template <
typename _Tp,
typename _Up>
1276 constexpr
const _Tp&
1278 {
return __p.first; }
1280 template <
typename _Tp,
typename _Up>
1285 template <
typename _Tp,
typename _Up>
1286 constexpr
const _Tp&&
1290 template <
typename _Tp,
typename _Up>
1293 {
return __p.second; }
1295 template <
typename _Tp,
typename _Up>
1296 constexpr
const _Tp&
1298 {
return __p.second; }
1300 template <
typename _Tp,
typename _Up>
1305 template <
typename _Tp,
typename _Up>
1306 constexpr
const _Tp&&
1312 #if __glibcxx_ranges_zip
1313 template<
typename _T1,
typename _T2,
typename _U1,
typename _U2,
1314 template<
typename>
class _TQual,
template<
typename>
class _UQual>
1315 requires requires {
typename pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>,
1316 common_reference_t<_TQual<_T2>, _UQual<_U2>>>; }
1317 struct basic_common_reference<pair<_T1, _T2>, pair<_U1, _U2>, _TQual, _UQual>
1319 using type = pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>,
1320 common_reference_t<_TQual<_T2>, _UQual<_U2>>>;
1323 template<
typename _T1,
typename _T2,
typename _U1,
typename _U2>
1324 requires requires {
typename pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>; }
1325 struct common_type<pair<_T1, _T2>, pair<_U1, _U2>>
1326 {
using type = pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>; };
1332 _GLIBCXX_END_NAMESPACE_VERSION
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
pair(_T1, _T2) -> pair< _T1, _T2 >
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 bool operator!=(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Uses operator== to find the result.
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 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 piecewise_construct_t piecewise_construct
Tag for piecewise construction of std::pair objects.
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 _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
ISO C++ entities toplevel namespace is std.
constexpr const _Tp && get(const pair< _Up, _Tp > &&__p) noexcept
A standard container for storing a fixed size sequence of elements.
Primary class template, tuple.
Define a member typedef type only if a boolean constant is true.
Struct holding two objects of arbitrary type.
constexpr pair(const _T1 &__a, const _T2 &__b)
Construct from two const lvalues, allowing implicit conversions.
_T1 first
The first member.
_T1 first_type
The type of the first 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 pair(const pair &)=default
Copy constructor.
_T2 second_type
The type of the second member.
constexpr pair(pair &&)=default
Move constructor.
_T2 second
The second member.
Tag type for piecewise construction of std::pair objects.
Finds the size of a given tuple type.
Gives the type of the ith element of a given tuple type.