61 #if __cplusplus >= 201103L
64 #if __cplusplus > 201703L
68 namespace std _GLIBCXX_VISIBILITY(default)
70 _GLIBCXX_BEGIN_NAMESPACE_VERSION
77 #if __cplusplus >= 201103L
91 template<std::size_t...>
99 template <
bool,
typename _T1,
typename _T2>
102 template <
typename _U1,
typename _U2>
103 static constexpr
bool _ConstructiblePair()
105 return __and_<is_constructible<_T1, const _U1&>,
109 template <
typename _U1,
typename _U2>
110 static constexpr
bool _ImplicitlyConvertiblePair()
112 return __and_<is_convertible<const _U1&, _T1>,
113 is_convertible<const _U2&, _T2>>::value;
116 template <
typename _U1,
typename _U2>
117 static constexpr
bool _MoveConstructiblePair()
119 return __and_<is_constructible<_T1, _U1&&>,
120 is_constructible<_T2, _U2&&>>::value;
123 template <
typename _U1,
typename _U2>
124 static constexpr
bool _ImplicitlyMoveConvertiblePair()
126 return __and_<is_convertible<_U1&&, _T1>,
127 is_convertible<_U2&&, _T2>>::value;
130 template <
bool __implicit,
typename _U1,
typename _U2>
131 static constexpr
bool _CopyMovePair()
133 using __do_converts = __and_<is_convertible<const _U1&, _T1>,
134 is_convertible<_U2&&, _T2>>;
135 using __converts =
typename conditional<__implicit,
137 __not_<__do_converts>>::type;
138 return __and_<is_constructible<_T1, const _U1&>,
139 is_constructible<_T2, _U2&&>,
144 template <
bool __implicit,
typename _U1,
typename _U2>
145 static constexpr
bool _MoveCopyPair()
147 using __do_converts = __and_<is_convertible<_U1&&, _T1>,
148 is_convertible<const _U2&, _T2>>;
149 using __converts =
typename conditional<__implicit,
151 __not_<__do_converts>>::type;
152 return __and_<is_constructible<_T1, _U1&&>,
153 is_constructible<_T2, const _U2&&>,
159 template <
typename _T1,
typename _T2>
160 struct _PCC<false, _T1, _T2>
162 template <
typename _U1,
typename _U2>
163 static constexpr
bool _ConstructiblePair()
168 template <
typename _U1,
typename _U2>
169 static constexpr
bool _ImplicitlyConvertiblePair()
174 template <
typename _U1,
typename _U2>
175 static constexpr
bool _MoveConstructiblePair()
180 template <
typename _U1,
typename _U2>
181 static constexpr
bool _ImplicitlyMoveConvertiblePair()
188 template<
typename _U1,
typename _U2>
class __pair_base
190 #if __cplusplus >= 201103L
191 template<
typename _T1,
typename _T2>
friend struct pair;
192 __pair_base() =
default;
193 ~__pair_base() =
default;
194 __pair_base(
const __pair_base&) =
default;
195 __pair_base& operator=(
const __pair_base&) =
delete;
209 template<
typename _T1,
typename _T2>
211 :
private __pair_base<_T1, _T2>
223 #if __cplusplus >= 201103L
224 template <
typename _U1 = _T1,
227 __is_implicitly_default_constructible<_U1>,
228 __is_implicitly_default_constructible<_U2>>
229 ::value,
bool>::type =
true>
234 #if __cplusplus >= 201103L
235 template <
typename _U1 = _T1,
241 __and_<__is_implicitly_default_constructible<_U1>,
242 __is_implicitly_default_constructible<_U2>>>>
243 ::value,
bool>::type =
false>
244 explicit constexpr
pair()
248 #if __cplusplus < 201103L
250 pair(
const _T1& __a,
const _T2& __b)
255 using _PCCP = _PCC<true, _T1, _T2>;
259 template<
typename _U1 = _T1,
typename _U2=_T2,
typename
260 enable_if<_PCCP::template
261 _ConstructiblePair<_U1, _U2>()
263 _ImplicitlyConvertiblePair<_U1, _U2>(),
265 constexpr
pair(
const _T1& __a,
const _T2& __b)
269 template<
typename _U1 = _T1,
typename _U2=_T2,
typename
271 _ConstructiblePair<_U1, _U2>()
273 _ImplicitlyConvertiblePair<_U1, _U2>(),
275 explicit constexpr
pair(
const _T1& __a,
const _T2& __b)
279 #if __cplusplus < 201103L
281 template<
typename _U1,
typename _U2>
287 template <
typename _U1,
typename _U2>
288 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
289 || !is_same<_T2, _U2>::value,
293 template<
typename _U1,
typename _U2,
typename
294 enable_if<_PCCFP<_U1, _U2>::template
295 _ConstructiblePair<_U1, _U2>()
296 && _PCCFP<_U1, _U2>::template
297 _ImplicitlyConvertiblePair<_U1, _U2>(),
299 constexpr
pair(
const pair<_U1, _U2>& __p)
302 template<
typename _U1,
typename _U2,
typename
303 enable_if<_PCCFP<_U1, _U2>::template
304 _ConstructiblePair<_U1, _U2>()
305 && !_PCCFP<_U1, _U2>::template
306 _ImplicitlyConvertiblePair<_U1, _U2>(),
308 explicit constexpr
pair(
const pair<_U1, _U2>& __p)
312 #if __cplusplus >= 201103L
313 constexpr
pair(
const pair&) =
default;
317 template<
typename _U1,
typename
318 enable_if<_PCCP::template
319 _MoveCopyPair<true, _U1, _T2>(),
321 constexpr
pair(_U1&& __x,
const _T2& __y)
324 template<
typename _U1,
typename
325 enable_if<_PCCP::template
326 _MoveCopyPair<false, _U1, _T2>(),
328 explicit constexpr
pair(_U1&& __x,
const _T2& __y)
331 template<
typename _U2,
typename
332 enable_if<_PCCP::template
333 _CopyMovePair<true, _T1, _U2>(),
335 constexpr
pair(
const _T1& __x, _U2&& __y)
338 template<
typename _U2,
typename
339 enable_if<_PCCP::template
340 _CopyMovePair<false, _T1, _U2>(),
342 explicit pair(
const _T1& __x, _U2&& __y)
345 template<
typename _U1,
typename _U2,
typename
346 enable_if<_PCCP::template
347 _MoveConstructiblePair<_U1, _U2>()
349 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
351 constexpr
pair(_U1&& __x, _U2&& __y)
354 template<
typename _U1,
typename _U2,
typename
355 enable_if<_PCCP::template
356 _MoveConstructiblePair<_U1, _U2>()
358 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
360 explicit constexpr
pair(_U1&& __x, _U2&& __y)
364 template<
typename _U1,
typename _U2,
typename
365 enable_if<_PCCFP<_U1, _U2>::template
366 _MoveConstructiblePair<_U1, _U2>()
367 && _PCCFP<_U1, _U2>::template
368 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
370 constexpr
pair(pair<_U1, _U2>&& __p)
374 template<
typename _U1,
typename _U2,
typename
375 enable_if<_PCCFP<_U1, _U2>::template
376 _MoveConstructiblePair<_U1, _U2>()
377 && !_PCCFP<_U1, _U2>::template
378 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
380 explicit constexpr
pair(pair<_U1, _U2>&& __p)
384 template<
typename... _Args1,
typename... _Args2>
386 pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>);
388 _GLIBCXX20_CONSTEXPR
pair&
389 operator=(
typename conditional<
390 __and_<is_copy_assignable<_T1>,
391 is_copy_assignable<_T2>>::value,
392 const pair&,
const __nonesuch&>::type __p)
399 _GLIBCXX20_CONSTEXPR
pair&
400 operator=(
typename conditional<
401 __and_<is_move_assignable<_T1>,
402 is_move_assignable<_T2>>::value,
403 pair&&, __nonesuch&&>::type __p)
404 noexcept(__and_<is_nothrow_move_assignable<_T1>,
405 is_nothrow_move_assignable<_T2>>::value)
407 first = std::forward<first_type>(__p.first);
408 second = std::forward<second_type>(__p.second);
412 template<
typename _U1,
typename _U2>
414 typename enable_if<__and_<is_assignable<_T1&, const _U1&>,
415 is_assignable<_T2&, const _U2&>>::value,
417 operator=(
const pair<_U1, _U2>& __p)
424 template<
typename _U1,
typename _U2>
426 typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
427 is_assignable<_T2&, _U2&&>>::value,
429 operator=(pair<_U1, _U2>&& __p)
431 first = std::forward<_U1>(__p.first);
432 second = std::forward<_U2>(__p.second);
437 _GLIBCXX20_CONSTEXPR
void
439 noexcept(__and_<__is_nothrow_swappable<_T1>,
440 __is_nothrow_swappable<_T2>>::value)
448 template<
typename... _Args1, std::size_t... _Indexes1,
449 typename... _Args2, std::size_t... _Indexes2>
452 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
458 #if __cpp_deduction_guides >= 201606
459 template<
typename _T1,
typename _T2> pair(_T1, _T2) -> pair<_T1, _T2>;
463 template<
typename _T1,
typename _T2>
464 inline _GLIBCXX_CONSTEXPR
bool
468 #if __cpp_lib_three_way_comparison && __cpp_lib_concepts
469 template<
typename _T1,
typename _T2>
470 constexpr common_comparison_category_t<__detail::__synth3way_t<_T1>,
471 __detail::__synth3way_t<_T2>>
474 if (
auto __c = __detail::__synth3way(__x.
first, __y.
first); __c != 0)
486 template<
typename _T1,
typename _T2>
487 inline _GLIBCXX_CONSTEXPR
bool
493 template<
typename _T1,
typename _T2>
494 inline _GLIBCXX_CONSTEXPR
bool
496 {
return !(__x == __y); }
499 template<
typename _T1,
typename _T2>
500 inline _GLIBCXX_CONSTEXPR
bool
502 {
return __y < __x; }
505 template<
typename _T1,
typename _T2>
506 inline _GLIBCXX_CONSTEXPR
bool
508 {
return !(__y < __x); }
511 template<
typename _T1,
typename _T2>
512 inline _GLIBCXX_CONSTEXPR
bool
514 {
return !(__x < __y); }
515 #endif // !(three_way_comparison && concepts)
517 #if __cplusplus >= 201103L
523 template<
typename _T1,
typename _T2>
524 _GLIBCXX20_CONSTEXPR
inline
525 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
528 __is_swappable<_T2>>::value>::type
533 noexcept(noexcept(__x.
swap(__y)))
536 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
537 template<
typename _T1,
typename _T2>
539 __is_swappable<_T2>>::value>::type
542 #endif // __cplusplus >= 201103L
561 #if __cplusplus >= 201103L
563 template<
typename _T1,
typename _T2>
565 typename __decay_and_strip<_T2>::__type>
568 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
569 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
571 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
574 template<
typename _T1,
typename _T2>
576 make_pair(_T1 __x, _T2 __y)
582 _GLIBCXX_END_NAMESPACE_VERSION