61 #if __cplusplus >= 201103L 64 #if __cplusplus > 201703L 66 # define __cpp_lib_constexpr_utility 201811L 69 namespace 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>,
117 template <
typename _U1,
typename _U2>
118 static constexpr
bool _MoveConstructiblePair()
120 return __and_<is_constructible<_T1, _U1&&>,
124 template <
typename _U1,
typename _U2>
125 static constexpr
bool _ImplicitlyMoveConvertiblePair()
127 return __and_<is_convertible<_U1&&, _T1>,
131 template <
bool __implicit,
typename _U1,
typename _U2>
132 static constexpr
bool _CopyMovePair()
134 using __do_converts = __and_<is_convertible<const _U1&, _T1>,
136 using __converts =
typename conditional<__implicit,
138 __not_<__do_converts>>::type;
139 return __and_<is_constructible<_T1, const _U1&>,
145 template <
bool __implicit,
typename _U1,
typename _U2>
146 static constexpr
bool _MoveCopyPair()
148 using __do_converts = __and_<is_convertible<_U1&&, _T1>,
150 using __converts =
typename conditional<__implicit,
152 __not_<__do_converts>>::type;
153 return __and_<is_constructible<_T1, _U1&&>,
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>
233 : first(), second() { }
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()
246 : first(), second() { }
249 #if __cplusplus < 201103L 251 pair(
const _T1& __a,
const _T2& __b)
252 : first(__a), second(__b) { }
256 using _PCCP = _PCC<true, _T1, _T2>;
260 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 262 _ConstructiblePair<_U1, _U2>()
264 _ImplicitlyConvertiblePair<_U1, _U2>(),
266 constexpr
pair(
const _T1& __a,
const _T2& __b)
267 : first(__a), second(__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)
277 : first(__a), second(__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
294 template<
typename _U1,
typename _U2,
typename 296 _ConstructiblePair<_U1, _U2>()
297 && _PCCFP<_U1, _U2>::template
298 _ImplicitlyConvertiblePair<_U1, _U2>(),
303 template<
typename _U1,
typename _U2,
typename 305 _ConstructiblePair<_U1, _U2>()
306 && !_PCCFP<_U1, _U2>::template
307 _ImplicitlyConvertiblePair<_U1, _U2>(),
313 #if __cplusplus >= 201103L 314 constexpr pair(
const pair&) =
default;
315 constexpr pair(pair&&) =
default;
318 template<
typename _U1,
typename 320 _MoveCopyPair<true, _U1, _T2>(),
322 constexpr pair(_U1&& __x,
const _T2& __y)
323 : first(std::forward<_U1>(__x)), second(__y) { }
325 template<
typename _U1,
typename 327 _MoveCopyPair<false, _U1, _T2>(),
329 explicit constexpr pair(_U1&& __x,
const _T2& __y)
330 : first(std::forward<_U1>(__x)), second(__y) { }
332 template<
typename _U2,
typename 334 _CopyMovePair<true, _T1, _U2>(),
336 constexpr pair(
const _T1& __x, _U2&& __y)
337 : first(__x), second(std::forward<_U2>(__y)) { }
339 template<
typename _U2,
typename 341 _CopyMovePair<false, _T1, _U2>(),
343 explicit pair(
const _T1& __x, _U2&& __y)
344 : first(__x), second(std::forward<_U2>(__y)) { }
346 template<
typename _U1,
typename _U2,
typename 348 _MoveConstructiblePair<_U1, _U2>()
350 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
352 constexpr pair(_U1&& __x, _U2&& __y)
353 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
355 template<
typename _U1,
typename _U2,
typename 357 _MoveConstructiblePair<_U1, _U2>()
359 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
361 explicit constexpr pair(_U1&& __x, _U2&& __y)
362 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
365 template<
typename _U1,
typename _U2,
typename 367 _MoveConstructiblePair<_U1, _U2>()
368 && _PCCFP<_U1, _U2>::template
369 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
372 : first(std::forward<_U1>(__p.
first)),
373 second(std::forward<_U2>(__p.
second)) { }
375 template<
typename _U1,
typename _U2,
typename 377 _MoveConstructiblePair<_U1, _U2>()
378 && !_PCCFP<_U1, _U2>::template
379 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
382 : first(std::forward<_U1>(__p.
first)),
383 second(std::forward<_U2>(__p.
second)) { }
385 template<
typename... _Args1,
typename... _Args2>
389 _GLIBCXX20_CONSTEXPR pair&
393 const pair&,
const __nonesuch&>::type __p)
400 _GLIBCXX20_CONSTEXPR pair&
404 pair&&, __nonesuch&&>::type __p)
408 first = std::forward<first_type>(__p.first);
409 second = std::forward<second_type>(__p.second);
413 template<
typename _U1,
typename _U2>
425 template<
typename _U1,
typename _U2>
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)
444 swap(first, __p.
first);
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 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 491 || (!(__y.
first < __x.first) && __x.second < __y.
second); }
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); }
516 #endif // !(three_way_comparison && concepts) 518 #if __cplusplus >= 201103L 524 template<
typename _T1,
typename _T2>
525 _GLIBCXX20_CONSTEXPR
inline 526 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 529 __is_swappable<_T2>>::value>::type
534 noexcept(noexcept(__x.swap(__y)))
537 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 538 template<
typename _T1,
typename _T2>
540 __is_swappable<_T2>>::value>::type
543 #endif // __cplusplus >= 201103L 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)
Two pairs of the same type are equal iff their members are equal.
constexpr piecewise_construct_t piecewise_construct
Tag for piecewise construction of std::pair objects.
_T2 second
The second member.
constexpr enable_if< __and_< __is_swappable< _T1 >, __is_swappable< _T2 > >::value >::type swap(pair< _T1, _T2 > &__x, pair< _T1, _T2 > &__y) noexcept(noexcept(__x.swap(__y)))
constexpr pair< 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.
_T2 second_type
The type of the second member.
constexpr bool operator>(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Uses operator< to find the result.
Tag type for piecewise construction of std::pair objects.
Primary class template, tuple.
is_nothrow_move_assignable
_T1 first
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.
Define a member typedef type to one of two argument types.
Struct holding two objects of arbitrary type.
_T1 first_type
The type of the first member.
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.
constexpr bool operator>=(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Uses operator< to find the result.
Define a member typedef type only if a boolean constant is true.
ISO C++ entities toplevel namespace is std.