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()
190 template<
typename _T1,
typename _T2>
193 typedef _T1 first_type;
203 #if __cplusplus >= 201103L 204 template <
typename _U1 = _T1,
206 typename enable_if<__and_<
207 __is_implicitly_default_constructible<_U1>,
208 __is_implicitly_default_constructible<_U2>>
209 ::value,
bool>::type =
true>
212 : first(), second() { }
214 #if __cplusplus >= 201103L 215 template <
typename _U1 = _T1,
217 typename enable_if<__and_<
218 is_default_constructible<_U1>,
219 is_default_constructible<_U2>,
221 __and_<__is_implicitly_default_constructible<_U1>,
222 __is_implicitly_default_constructible<_U2>>>>
223 ::value,
bool>::type =
false>
224 explicit constexpr
pair()
225 : first(), second() { }
229 #if __cplusplus < 201103L 230 pair(
const _T1& __a,
const _T2& __b)
231 : first(__a), second(__b) { }
236 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 237 enable_if<_PCCP::template
238 _ConstructiblePair<_U1, _U2>()
240 _ImplicitlyConvertiblePair<_U1, _U2>(),
242 constexpr pair(
const _T1& __a,
const _T2& __b)
243 : first(__a), second(__b) { }
245 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 246 enable_if<_PCCP::template
247 _ConstructiblePair<_U1, _U2>()
249 _ImplicitlyConvertiblePair<_U1, _U2>(),
251 explicit constexpr pair(
const _T1& __a,
const _T2& __b)
252 : first(__a), second(__b) { }
256 #if __cplusplus < 201103L 257 template<
typename _U1,
typename _U2>
262 template <
typename _U1,
typename _U2>
263 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
264 || !is_same<_T2, _U2>::value,
267 template<
typename _U1,
typename _U2,
typename 268 enable_if<_PCCFP<_U1, _U2>::template
269 _ConstructiblePair<_U1, _U2>()
271 _ImplicitlyConvertiblePair<_U1, _U2>(),
274 : first(__p.first), second(__p.second) { }
276 template<
typename _U1,
typename _U2,
typename 277 enable_if<_PCCFP<_U1, _U2>::template
278 _ConstructiblePair<_U1, _U2>()
280 _ImplicitlyConvertiblePair<_U1, _U2>(),
285 constexpr pair(
const pair&) =
default;
286 constexpr pair(pair&&) =
default;
289 template<
typename _U1,
typename 290 enable_if<_PCCP::template
291 _MoveCopyPair<true, _U1, _T2>(),
293 constexpr pair(_U1&& __x,
const _T2& __y)
294 : first(std::forward<_U1>(__x)), second(__y) { }
296 template<
typename _U1,
typename 297 enable_if<_PCCP::template
298 _MoveCopyPair<false, _U1, _T2>(),
300 explicit constexpr pair(_U1&& __x,
const _T2& __y)
301 : first(std::forward<_U1>(__x)), second(__y) { }
303 template<
typename _U2,
typename 304 enable_if<_PCCP::template
305 _CopyMovePair<true, _T1, _U2>(),
307 constexpr pair(
const _T1& __x, _U2&& __y)
308 : first(__x), second(std::forward<_U2>(__y)) { }
310 template<
typename _U2,
typename 311 enable_if<_PCCP::template
312 _CopyMovePair<false, _T1, _U2>(),
314 explicit pair(
const _T1& __x, _U2&& __y)
315 : first(__x), second(std::forward<_U2>(__y)) { }
317 template<
typename _U1,
typename _U2,
typename 318 enable_if<_PCCP::template
319 _MoveConstructiblePair<_U1, _U2>()
321 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
323 constexpr pair(_U1&& __x, _U2&& __y)
324 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
326 template<
typename _U1,
typename _U2,
typename 327 enable_if<_PCCP::template
328 _MoveConstructiblePair<_U1, _U2>()
330 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
332 explicit constexpr pair(_U1&& __x, _U2&& __y)
333 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
336 template<
typename _U1,
typename _U2,
typename 337 enable_if<_PCCFP<_U1, _U2>::template
338 _MoveConstructiblePair<_U1, _U2>()
340 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
343 : first(std::forward<_U1>(__p.
first)),
344 second(std::forward<_U2>(__p.
second)) { }
346 template<
typename _U1,
typename _U2,
typename 347 enable_if<_PCCFP<_U1, _U2>::template
348 _MoveConstructiblePair<_U1, _U2>()
350 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
353 : first(std::forward<_U1>(__p.
first)),
354 second(std::forward<_U2>(__p.
second)) { }
356 template<
typename... _Args1,
typename... _Args2>
360 operator=(
typename conditional<
361 __and_<is_copy_assignable<_T1>,
362 is_copy_assignable<_T2>>::value,
363 const pair&,
const __nonesuch&>::type __p)
371 operator=(
typename conditional<
372 __not_<__and_<is_copy_assignable<_T1>,
373 is_copy_assignable<_T2>>>::value,
374 const pair&,
const __nonesuch&>::type __p) =
delete;
377 operator=(
typename conditional<
378 __and_<is_move_assignable<_T1>,
379 is_move_assignable<_T2>>::value,
380 pair&&, __nonesuch&&>::type __p)
381 noexcept(__and_<is_nothrow_move_assignable<_T1>,
382 is_nothrow_move_assignable<_T2>>::value)
384 first = std::forward<first_type>(__p.first);
385 second = std::forward<second_type>(__p.second);
389 template<
typename _U1,
typename _U2>
390 typename enable_if<__and_<is_assignable<_T1&, const _U1&>,
391 is_assignable<_T2&, const _U2&>>::value,
400 template<
typename _U1,
typename _U2>
401 typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
402 is_assignable<_T2&, _U2&&>>::value,
406 first = std::forward<_U1>(__p.
first);
407 second = std::forward<_U2>(__p.
second);
413 noexcept(__and_<__is_nothrow_swappable<_T1>,
414 __is_nothrow_swappable<_T2>>::value)
417 swap(first, __p.
first);
422 template<
typename... _Args1, std::size_t... _Indexes1,
423 typename... _Args2, std::size_t... _Indexes2>
425 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
429 #if __cpp_deduction_guides >= 201606 434 template<
typename _T1,
typename _T2>
435 inline _GLIBCXX_CONSTEXPR
bool 440 template<
typename _T1,
typename _T2>
441 inline _GLIBCXX_CONSTEXPR
bool 443 {
return __x.
first < __y.first
444 || (!(__y.first < __x.first) && __x.second < __y.second); }
447 template<
typename _T1,
typename _T2>
448 inline _GLIBCXX_CONSTEXPR
bool 450 {
return !(__x == __y); }
453 template<
typename _T1,
typename _T2>
454 inline _GLIBCXX_CONSTEXPR
bool 456 {
return __y < __x; }
459 template<
typename _T1,
typename _T2>
460 inline _GLIBCXX_CONSTEXPR
bool 462 {
return !(__y < __x); }
465 template<
typename _T1,
typename _T2>
466 inline _GLIBCXX_CONSTEXPR
bool 468 {
return !(__x < __y); }
470 #if __cplusplus >= 201103L 474 template<
typename _T1,
typename _T2>
476 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 478 typename enable_if<__and_<__is_swappable<_T1>,
479 __is_swappable<_T2>>::value>::type
484 noexcept(noexcept(__x.swap(__y)))
487 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 488 template<
typename _T1,
typename _T2>
489 typename enable_if<!__and_<__is_swappable<_T1>,
490 __is_swappable<_T2>>::value>::type
493 #endif // __cplusplus >= 201103L 507 #if __cplusplus >= 201103L 509 template<
typename _T1,
typename _T2>
511 typename __decay_and_strip<_T2>::__type>
514 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
515 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
517 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
520 template<
typename _T1,
typename _T2>
528 _GLIBCXX_END_NAMESPACE_VERSION
_GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct
piecewise_construct
_T2 second
first is a copy of the first object
Primary class template, tuple.
ISO C++ entities toplevel namespace is std.
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
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
Struct holding two objects of arbitrary type.
_PCC<!is_same< _BiIter, _U1 >::value||!is_same< _BiIter, _U2 >::value, _BiIter, _BiIter > _PCCFP