61#if __cplusplus >= 201103L
64#if __cplusplus > 201703L
66# define __cpp_lib_constexpr_utility 201811L
69namespace std _GLIBCXX_VISIBILITY(default)
71_GLIBCXX_BEGIN_NAMESPACE_VERSION
78#if __cplusplus >= 201103L
100 template <
bool,
typename _T1,
typename _T2>
103 template <
typename _U1,
typename _U2>
104 static constexpr bool _ConstructiblePair()
106 return __and_<is_constructible<_T1, const _U1&>,
110 template <
typename _U1,
typename _U2>
111 static constexpr bool _ImplicitlyConvertiblePair()
113 return __and_<is_convertible<const _U1&, _T1>,
114 is_convertible<const _U2&, _T2>>::value;
117 template <
typename _U1,
typename _U2>
118 static constexpr bool _MoveConstructiblePair()
120 return __and_<is_constructible<_T1, _U1&&>,
121 is_constructible<_T2, _U2&&>>::value;
124 template <
typename _U1,
typename _U2>
125 static constexpr bool _ImplicitlyMoveConvertiblePair()
127 return __and_<is_convertible<_U1&&, _T1>,
128 is_convertible<_U2&&, _T2>>::value;
131 template <
bool __implicit,
typename _U1,
typename _U2>
132 static constexpr bool _CopyMovePair()
134 using __do_converts = __and_<is_convertible<const _U1&, _T1>,
135 is_convertible<_U2&&, _T2>>;
136 using __converts =
typename conditional<__implicit,
138 __not_<__do_converts>>::type;
139 return __and_<is_constructible<_T1, const _U1&>,
140 is_constructible<_T2, _U2&&>,
145 template <
bool __implicit,
typename _U1,
typename _U2>
146 static constexpr bool _MoveCopyPair()
148 using __do_converts = __and_<is_convertible<_U1&&, _T1>,
149 is_convertible<const _U2&, _T2>>;
150 using __converts =
typename conditional<__implicit,
152 __not_<__do_converts>>::type;
153 return __and_<is_constructible<_T1, _U1&&>,
154 is_constructible<_T2, const _U2&&>,
160 template <
typename _T1,
typename _T2>
161 struct _PCC<false, _T1, _T2>
163 template <
typename _U1,
typename _U2>
164 static constexpr bool _ConstructiblePair()
169 template <
typename _U1,
typename _U2>
170 static constexpr bool _ImplicitlyConvertiblePair()
175 template <
typename _U1,
typename _U2>
176 static constexpr bool _MoveConstructiblePair()
181 template <
typename _U1,
typename _U2>
182 static constexpr bool _ImplicitlyMoveConvertiblePair()
189 template<
typename _U1,
typename _U2>
class __pair_base
191#if __cplusplus >= 201103L
192 template<
typename _T1,
typename _T2>
friend struct pair;
193 __pair_base() =
default;
194 ~__pair_base() =
default;
195 __pair_base(
const __pair_base&) =
default;
196 __pair_base& operator=(
const __pair_base&) =
delete;
210 template<
typename _T1,
typename _T2>
212 :
private __pair_base<_T1, _T2>
224#if __cplusplus >= 201103L
225 template <
typename _U1 = _T1,
228 __is_implicitly_default_constructible<_U1>,
229 __is_implicitly_default_constructible<_U2>>
230 ::value,
bool>::type =
true>
235#if __cplusplus >= 201103L
236 template <
typename _U1 = _T1,
242 __and_<__is_implicitly_default_constructible<_U1>,
243 __is_implicitly_default_constructible<_U2>>>>
244 ::value,
bool>::type =
false>
245 explicit constexpr pair()
249#if __cplusplus < 201103L
251 pair(
const _T1& __a,
const _T2& __b)
256 using _PCCP = _PCC<true, _T1, _T2>;
260 template<
typename _U1 = _T1,
typename _U2=_T2,
typename
261 enable_if<_PCCP::template
262 _ConstructiblePair<_U1, _U2>()
264 _ImplicitlyConvertiblePair<_U1, _U2>(),
266 constexpr pair(
const _T1& __a,
const _T2& __b)
270 template<
typename _U1 = _T1,
typename _U2=_T2,
typename
272 _ConstructiblePair<_U1, _U2>()
274 _ImplicitlyConvertiblePair<_U1, _U2>(),
276 explicit constexpr pair(
const _T1& __a,
const _T2& __b)
280#if __cplusplus < 201103L
282 template<
typename _U1,
typename _U2>
288 template <
typename _U1,
typename _U2>
289 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
290 || !is_same<_T2, _U2>::value,
294 template<
typename _U1,
typename _U2,
typename
295 enable_if<_PCCFP<_U1, _U2>::template
296 _ConstructiblePair<_U1, _U2>()
297 && _PCCFP<_U1, _U2>::template
298 _ImplicitlyConvertiblePair<_U1, _U2>(),
300 constexpr pair(
const pair<_U1, _U2>& __p)
303 template<
typename _U1,
typename _U2,
typename
304 enable_if<_PCCFP<_U1, _U2>::template
305 _ConstructiblePair<_U1, _U2>()
306 && !_PCCFP<_U1, _U2>::template
307 _ImplicitlyConvertiblePair<_U1, _U2>(),
309 explicit constexpr pair(
const pair<_U1, _U2>& __p)
313#if __cplusplus >= 201103L
318 template<
typename _U1,
typename
320 _MoveCopyPair<true, _U1, _T2>(),
322 constexpr pair(_U1&& __x,
const _T2& __y)
325 template<
typename _U1,
typename
327 _MoveCopyPair<false, _U1, _T2>(),
329 explicit constexpr pair(_U1&& __x,
const _T2& __y)
332 template<
typename _U2,
typename
333 enable_if<_PCCP::template
334 _CopyMovePair<true, _T1, _U2>(),
336 constexpr pair(
const _T1& __x, _U2&& __y)
339 template<
typename _U2,
typename
340 enable_if<_PCCP::template
341 _CopyMovePair<false, _T1, _U2>(),
343 explicit pair(
const _T1& __x, _U2&& __y)
346 template<
typename _U1,
typename _U2,
typename
347 enable_if<_PCCP::template
348 _MoveConstructiblePair<_U1, _U2>()
350 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
352 constexpr pair(_U1&& __x, _U2&& __y)
355 template<
typename _U1,
typename _U2,
typename
356 enable_if<_PCCP::template
357 _MoveConstructiblePair<_U1, _U2>()
359 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
361 explicit constexpr pair(_U1&& __x, _U2&& __y)
365 template<
typename _U1,
typename _U2,
typename
366 enable_if<_PCCFP<_U1, _U2>::template
367 _MoveConstructiblePair<_U1, _U2>()
368 && _PCCFP<_U1, _U2>::template
369 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
371 constexpr pair(pair<_U1, _U2>&& __p)
375 template<
typename _U1,
typename _U2,
typename
376 enable_if<_PCCFP<_U1, _U2>::template
377 _MoveConstructiblePair<_U1, _U2>()
378 && !_PCCFP<_U1, _U2>::template
379 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
381 explicit constexpr pair(pair<_U1, _U2>&& __p)
385 template<
typename... _Args1,
typename... _Args2>
387 pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>);
389 _GLIBCXX20_CONSTEXPR
pair&
390 operator=(
typename conditional<
391 __and_<is_copy_assignable<_T1>,
392 is_copy_assignable<_T2>>::value,
393 const pair&,
const __nonesuch&>::type __p)
400 _GLIBCXX20_CONSTEXPR
pair&
401 operator=(
typename conditional<
402 __and_<is_move_assignable<_T1>,
403 is_move_assignable<_T2>>::value,
404 pair&&, __nonesuch&&>::type __p)
405 noexcept(__and_<is_nothrow_move_assignable<_T1>,
406 is_nothrow_move_assignable<_T2>>::value)
408 first = std::forward<first_type>(__p.first);
409 second = std::forward<second_type>(__p.second);
413 template<
typename _U1,
typename _U2>
415 typename enable_if<__and_<is_assignable<_T1&, const _U1&>,
416 is_assignable<_T2&, const _U2&>>::value,
418 operator=(
const pair<_U1, _U2>& __p)
425 template<
typename _U1,
typename _U2>
427 typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
428 is_assignable<_T2&, _U2&&>>::value,
430 operator=(pair<_U1, _U2>&& __p)
432 first = std::forward<_U1>(__p.first);
433 second = std::forward<_U2>(__p.second);
438 _GLIBCXX20_CONSTEXPR
void
440 noexcept(__and_<__is_nothrow_swappable<_T1>,
441 __is_nothrow_swappable<_T2>>::value)
449 template<
typename... _Args1,
size_t... _Indexes1,
450 typename... _Args2,
size_t... _Indexes2>
453 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
459#if __cpp_deduction_guides >= 201606
460 template<
typename _T1,
typename _T2> pair(_T1, _T2) -> pair<_T1, _T2>;
464 template<
typename _T1,
typename _T2>
465 inline _GLIBCXX_CONSTEXPR
bool
469#if __cpp_lib_three_way_comparison && __cpp_lib_concepts
470 template<
typename _T1,
typename _T2>
471 constexpr common_comparison_category_t<__detail::__synth3way_t<_T1>,
472 __detail::__synth3way_t<_T2>>
475 if (
auto __c = __detail::__synth3way(__x.
first, __y.
first); __c != 0)
487 template<
typename _T1,
typename _T2>
488 inline _GLIBCXX_CONSTEXPR
bool
494 template<
typename _T1,
typename _T2>
495 inline _GLIBCXX_CONSTEXPR
bool
497 {
return !(__x == __y); }
500 template<
typename _T1,
typename _T2>
501 inline _GLIBCXX_CONSTEXPR
bool
503 {
return __y < __x; }
506 template<
typename _T1,
typename _T2>
507 inline _GLIBCXX_CONSTEXPR
bool
509 {
return !(__y < __x); }
512 template<
typename _T1,
typename _T2>
513 inline _GLIBCXX_CONSTEXPR
bool
515 {
return !(__x < __y); }
518#if __cplusplus >= 201103L
524 template<
typename _T1,
typename _T2>
525 _GLIBCXX20_CONSTEXPR
inline
526#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
529 __is_swappable<_T2>>::value>::type
534 noexcept(
noexcept(__x.
swap(__y)))
537#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
538 template<
typename _T1,
typename _T2>
540 __is_swappable<_T2>>::value>::type
562#if __cplusplus >= 201103L
564 template<
typename _T1,
typename _T2>
566 typename __decay_and_strip<_T2>::__type>
569 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
570 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
572 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
575 template<
typename _T1,
typename _T2>
577 make_pair(_T1 __x, _T2 __y)
583_GLIBCXX_END_NAMESPACE_VERSION
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)
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 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.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
ISO C++ entities toplevel namespace is std.
Primary class template, tuple.
Define a member typedef type only if a boolean constant is true.
Tag type for piecewise construction of std::pair objects.
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.