61 #if __cplusplus >= 201103L 65 namespace std _GLIBCXX_VISIBILITY(default)
67 _GLIBCXX_BEGIN_NAMESPACE_VERSION
74 #if __cplusplus >= 201103L 86 template<std::size_t...>
94 template <
bool,
typename _T1,
typename _T2>
97 template <
typename _U1,
typename _U2>
98 static constexpr
bool _ConstructiblePair()
100 return __and_<is_constructible<_T1, const _U1&>,
104 template <
typename _U1,
typename _U2>
105 static constexpr
bool _ImplicitlyConvertiblePair()
107 return __and_<is_convertible<const _U1&, _T1>,
108 is_convertible<const _U2&, _T2>>::value;
111 template <
typename _U1,
typename _U2>
112 static constexpr
bool _MoveConstructiblePair()
114 return __and_<is_constructible<_T1, _U1&&>,
115 is_constructible<_T2, _U2&&>>::value;
118 template <
typename _U1,
typename _U2>
119 static constexpr
bool _ImplicitlyMoveConvertiblePair()
121 return __and_<is_convertible<_U1&&, _T1>,
122 is_convertible<_U2&&, _T2>>::value;
125 template <
bool __implicit,
typename _U1,
typename _U2>
126 static constexpr
bool _CopyMovePair()
128 using __do_converts = __and_<is_convertible<const _U1&, _T1>,
129 is_convertible<_U2&&, _T2>>;
130 using __converts =
typename conditional<__implicit,
132 __not_<__do_converts>>::type;
133 return __and_<is_constructible<_T1, const _U1&>,
134 is_constructible<_T2, _U2&&>,
139 template <
bool __implicit,
typename _U1,
typename _U2>
140 static constexpr
bool _MoveCopyPair()
142 using __do_converts = __and_<is_convertible<_U1&&, _T1>,
143 is_convertible<const _U2&, _T2>>;
144 using __converts =
typename conditional<__implicit,
146 __not_<__do_converts>>::type;
147 return __and_<is_constructible<_T1, _U1&&>,
148 is_constructible<_T2, const _U2&&>,
154 template <
typename _T1,
typename _T2>
155 struct _PCC<false, _T1, _T2>
157 template <
typename _U1,
typename _U2>
158 static constexpr
bool _ConstructiblePair()
163 template <
typename _U1,
typename _U2>
164 static constexpr
bool _ImplicitlyConvertiblePair()
169 template <
typename _U1,
typename _U2>
170 static constexpr
bool _MoveConstructiblePair()
175 template <
typename _U1,
typename _U2>
176 static constexpr
bool _ImplicitlyMoveConvertiblePair()
185 struct __nonesuch_no_braces : std::__nonesuch {
186 explicit __nonesuch_no_braces(
const __nonesuch&) =
delete;
190 template<
typename _U1,
typename _U2>
class __pair_base
192 #if __cplusplus >= 201103L 193 template<
typename _T1,
typename _T2>
friend struct pair;
194 __pair_base() =
default;
195 ~__pair_base() =
default;
196 __pair_base(
const __pair_base&) =
default;
197 __pair_base& operator=(
const __pair_base&) =
delete;
207 template<
typename _T1,
typename _T2>
209 :
private __pair_base<_T1, _T2>
211 typedef _T1 first_type;
221 #if __cplusplus >= 201103L 222 template <
typename _U1 = _T1,
225 __is_implicitly_default_constructible<_U1>,
226 __is_implicitly_default_constructible<_U2>>
227 ::value,
bool>::type =
true>
232 #if __cplusplus >= 201103L 233 template <
typename _U1 = _T1,
239 __and_<__is_implicitly_default_constructible<_U1>,
240 __is_implicitly_default_constructible<_U2>>>>
241 ::value,
bool>::type =
false>
242 explicit constexpr
pair()
247 #if __cplusplus < 201103L 248 pair(
const _T1& __a,
const _T2& __b)
254 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 256 _ConstructiblePair<_U1, _U2>()
258 _ImplicitlyConvertiblePair<_U1, _U2>(),
260 constexpr
pair(
const _T1& __a,
const _T2& __b)
263 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 265 _ConstructiblePair<_U1, _U2>()
267 _ImplicitlyConvertiblePair<_U1, _U2>(),
269 explicit constexpr
pair(
const _T1& __a,
const _T2& __b)
274 #if __cplusplus < 201103L 275 template<
typename _U1,
typename _U2>
276 pair(
const pair<_U1, _U2>& __p)
280 template <
typename _U1,
typename _U2>
281 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
282 || !is_same<_T2, _U2>::value,
285 template<
typename _U1,
typename _U2,
typename 287 _ConstructiblePair<_U1, _U2>()
289 _ImplicitlyConvertiblePair<_U1, _U2>(),
294 template<
typename _U1,
typename _U2,
typename 296 _ConstructiblePair<_U1, _U2>()
297 && !_PCCFP<_U1, _U2>::template
298 _ImplicitlyConvertiblePair<_U1, _U2>(),
303 constexpr
pair(
const pair&) =
default;
307 template<
typename _U1,
typename 308 enable_if<_PCCP::template
309 _MoveCopyPair<true, _U1, _T2>(),
311 constexpr
pair(_U1&& __x,
const _T2& __y)
314 template<
typename _U1,
typename 315 enable_if<_PCCP::template
316 _MoveCopyPair<false, _U1, _T2>(),
318 explicit constexpr
pair(_U1&& __x,
const _T2& __y)
321 template<
typename _U2,
typename 322 enable_if<_PCCP::template
323 _CopyMovePair<true, _T1, _U2>(),
325 constexpr
pair(
const _T1& __x, _U2&& __y)
328 template<
typename _U2,
typename 329 enable_if<_PCCP::template
330 _CopyMovePair<false, _T1, _U2>(),
332 explicit pair(
const _T1& __x, _U2&& __y)
335 template<
typename _U1,
typename _U2,
typename 336 enable_if<_PCCP::template
337 _MoveConstructiblePair<_U1, _U2>()
339 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
341 constexpr
pair(_U1&& __x, _U2&& __y)
344 template<
typename _U1,
typename _U2,
typename 345 enable_if<_PCCP::template
346 _MoveConstructiblePair<_U1, _U2>()
348 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
350 explicit constexpr
pair(_U1&& __x, _U2&& __y)
354 template<
typename _U1,
typename _U2,
typename 355 enable_if<_PCCFP<_U1, _U2>::template
356 _MoveConstructiblePair<_U1, _U2>()
357 && _PCCFP<_U1, _U2>::template
358 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
360 constexpr
pair(pair<_U1, _U2>&& __p)
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 explicit constexpr
pair(pair<_U1, _U2>&& __p)
374 template<
typename... _Args1,
typename... _Args2>
375 pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>);
378 operator=(
typename conditional<
379 __and_<is_copy_assignable<_T1>,
380 is_copy_assignable<_T2>>::value,
381 const pair&,
const __nonesuch_no_braces&>::type __p)
389 operator=(
typename conditional<
390 __and_<is_move_assignable<_T1>,
391 is_move_assignable<_T2>>::value,
392 pair&&, __nonesuch_no_braces&&>::type __p)
393 noexcept(__and_<is_nothrow_move_assignable<_T1>,
394 is_nothrow_move_assignable<_T2>>::value)
396 first = std::forward<first_type>(__p.first);
397 second = std::forward<second_type>(__p.second);
401 template<
typename _U1,
typename _U2>
402 typename enable_if<__and_<is_assignable<_T1&, const _U1&>,
403 is_assignable<_T2&, const _U2&>>::value,
405 operator=(
const pair<_U1, _U2>& __p)
412 template<
typename _U1,
typename _U2>
413 typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
414 is_assignable<_T2&, _U2&&>>::value,
416 operator=(pair<_U1, _U2>&& __p)
418 first = std::forward<_U1>(__p.first);
419 second = std::forward<_U2>(__p.second);
425 noexcept(__and_<__is_nothrow_swappable<_T1>,
426 __is_nothrow_swappable<_T2>>::value)
429 swap(
first, __p.first);
434 template<
typename... _Args1, std::size_t... _Indexes1,
435 typename... _Args2, std::size_t... _Indexes2>
436 pair(tuple<_Args1...>&, tuple<_Args2...>&,
437 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
441 #if __cpp_deduction_guides >= 201606 442 template<
typename _T1,
typename _T2> pair(_T1, _T2) -> pair<_T1, _T2>;
446 template<
typename _T1,
typename _T2>
447 inline _GLIBCXX_CONSTEXPR
bool 452 template<
typename _T1,
typename _T2>
453 inline _GLIBCXX_CONSTEXPR
bool 459 template<
typename _T1,
typename _T2>
460 inline _GLIBCXX_CONSTEXPR
bool 462 {
return !(__x == __y); }
465 template<
typename _T1,
typename _T2>
466 inline _GLIBCXX_CONSTEXPR
bool 468 {
return __y < __x; }
471 template<
typename _T1,
typename _T2>
472 inline _GLIBCXX_CONSTEXPR
bool 474 {
return !(__y < __x); }
477 template<
typename _T1,
typename _T2>
478 inline _GLIBCXX_CONSTEXPR
bool 480 {
return !(__x < __y); }
482 #if __cplusplus >= 201103L 486 template<
typename _T1,
typename _T2>
488 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 490 typename enable_if<__and_<__is_swappable<_T1>,
491 __is_swappable<_T2>>::value>::type
496 noexcept(noexcept(__x.swap(__y)))
499 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 500 template<
typename _T1,
typename _T2>
501 typename enable_if<!__and_<__is_swappable<_T1>,
502 __is_swappable<_T2>>::value>::type
503 swap(pair<_T1, _T2>&, pair<_T1, _T2>&) =
delete;
505 #endif // __cplusplus >= 201103L 519 #if __cplusplus >= 201103L 521 template<
typename _T1,
typename _T2>
522 constexpr pair<typename __decay_and_strip<_T1>::__type,
523 typename __decay_and_strip<_T2>::__type>
526 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
527 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
529 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
532 template<
typename _T1,
typename _T2>
533 inline pair<_T1, _T2>
535 {
return pair<_T1, _T2>(__x, __y); }
540 _GLIBCXX_END_NAMESPACE_VERSION
Struct holding two objects of arbitrary type.
Define a member typedef type only if a boolean constant is true.
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.
ISO C++ entities toplevel namespace is std.
_PCC< true, _BiIter, _BiIter > _PCCP
Primary class template, tuple.
constexpr pair()
second is a copy of the second object
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
_T2 second_type
first_type is the first bound type
_T1 first
second_type is the second bound type
_GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct
piecewise_construct
_T2 second
first is a copy of the first object
_PCC<!is_same< _T1, _U1 >::value||!is_same< _T2, _U2 >::value, _T1, _T2 > _PCCFP