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&>,
101 is_constructible<_T2, const _U2&>>::value;
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;
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
211 typedef _T1 first_type;
221 #if __cplusplus >= 201103L 222 template <
typename _U1 = _T1,
224 typename enable_if<__and_<
225 __is_implicitly_default_constructible<_U1>,
226 __is_implicitly_default_constructible<_U2>>
227 ::value,
bool>::type =
true>
230 : first(), second() { }
232 #if __cplusplus >= 201103L 233 template <
typename _U1 = _T1,
235 typename enable_if<__and_<
236 is_default_constructible<_U1>,
237 is_default_constructible<_U2>,
239 __and_<__is_implicitly_default_constructible<_U1>,
240 __is_implicitly_default_constructible<_U2>>>>
241 ::value,
bool>::type =
false>
242 explicit constexpr
pair()
243 : first(), second() { }
247 #if __cplusplus < 201103L 248 pair(
const _T1& __a,
const _T2& __b)
249 : first(__a), second(__b) { }
254 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 255 enable_if<_PCCP::template
256 _ConstructiblePair<_U1, _U2>()
258 _ImplicitlyConvertiblePair<_U1, _U2>(),
260 constexpr pair(
const _T1& __a,
const _T2& __b)
261 : first(__a), second(__b) { }
263 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 264 enable_if<_PCCP::template
265 _ConstructiblePair<_U1, _U2>()
267 _ImplicitlyConvertiblePair<_U1, _U2>(),
269 explicit constexpr pair(
const _T1& __a,
const _T2& __b)
270 : first(__a), second(__b) { }
274 #if __cplusplus < 201103L 275 template<
typename _U1,
typename _U2>
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 286 enable_if<_PCCFP<_U1, _U2>::template
287 _ConstructiblePair<_U1, _U2>()
289 _ImplicitlyConvertiblePair<_U1, _U2>(),
292 : first(__p.first), second(__p.second) { }
294 template<
typename _U1,
typename _U2,
typename 295 enable_if<_PCCFP<_U1, _U2>::template
296 _ConstructiblePair<_U1, _U2>()
298 _ImplicitlyConvertiblePair<_U1, _U2>(),
303 constexpr pair(
const pair&) =
default;
304 constexpr pair(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)
312 : first(std::forward<_U1>(__x)), second(__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)
319 : first(std::forward<_U1>(__x)), second(__y) { }
321 template<
typename _U2,
typename 322 enable_if<_PCCP::template
323 _CopyMovePair<true, _T1, _U2>(),
325 constexpr pair(
const _T1& __x, _U2&& __y)
326 : first(__x), second(std::forward<_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)
333 : first(__x), second(std::forward<_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)
342 : first(std::forward<_U1>(__x)), second(std::forward<_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)
351 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
354 template<
typename _U1,
typename _U2,
typename 355 enable_if<_PCCFP<_U1, _U2>::template
356 _MoveConstructiblePair<_U1, _U2>()
358 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
361 : first(std::forward<_U1>(__p.
first)),
362 second(std::forward<_U2>(__p.
second)) { }
364 template<
typename _U1,
typename _U2,
typename 365 enable_if<_PCCFP<_U1, _U2>::template
366 _MoveConstructiblePair<_U1, _U2>()
368 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
371 : first(std::forward<_U1>(__p.
first)),
372 second(std::forward<_U2>(__p.
second)) { }
374 template<
typename... _Args1,
typename... _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,
412 template<
typename _U1,
typename _U2>
413 typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
414 is_assignable<_T2&, _U2&&>>::value,
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>
437 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
441 #if __cpp_deduction_guides >= 201606 446 template<
typename _T1,
typename _T2>
447 inline _GLIBCXX_CONSTEXPR
bool 452 template<
typename _T1,
typename _T2>
453 inline _GLIBCXX_CONSTEXPR
bool 455 {
return __x.
first < __y.first
456 || (!(__y.first < __x.first) && __x.second < __y.second); }
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
505 #endif // __cplusplus >= 201103L 519 #if __cplusplus >= 201103L 521 template<
typename _T1,
typename _T2>
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>
540 _GLIBCXX_END_NAMESPACE_VERSION
_T2 second
first is a copy of the first object
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.
_PCC< true, _BiIter, _BiIter > _PCCP
Struct holding two objects of arbitrary type.
_GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct
piecewise_construct
ISO C++ entities toplevel namespace is std.
_PCC<!is_same< _BiIter, _U1 >::value||!is_same< _BiIter, _U2 >::value, _BiIter, _BiIter > _PCCFP
Primary class template, tuple.
constexpr pair()
second is a copy of the second object
_T1 first
second_type is the second bound type
_T2 second_type
first_type is the first bound type