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;
197 template<
typename _T1,
typename _T2>
200 typedef _T1 first_type;
210 #if __cplusplus >= 201103L 211 template <
typename _U1 = _T1,
213 typename enable_if<__and_<
214 __is_implicitly_default_constructible<_U1>,
215 __is_implicitly_default_constructible<_U2>>
216 ::value,
bool>::type =
true>
219 : first(), second() { }
221 #if __cplusplus >= 201103L 222 template <
typename _U1 = _T1,
224 typename enable_if<__and_<
225 is_default_constructible<_U1>,
226 is_default_constructible<_U2>,
228 __and_<__is_implicitly_default_constructible<_U1>,
229 __is_implicitly_default_constructible<_U2>>>>
230 ::value,
bool>::type =
false>
231 explicit constexpr
pair()
232 : first(), second() { }
236 #if __cplusplus < 201103L 237 pair(
const _T1& __a,
const _T2& __b)
238 : first(__a), second(__b) { }
243 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 244 enable_if<_PCCP::template
245 _ConstructiblePair<_U1, _U2>()
247 _ImplicitlyConvertiblePair<_U1, _U2>(),
249 constexpr pair(
const _T1& __a,
const _T2& __b)
250 : first(__a), second(__b) { }
252 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 253 enable_if<_PCCP::template
254 _ConstructiblePair<_U1, _U2>()
256 _ImplicitlyConvertiblePair<_U1, _U2>(),
258 explicit constexpr pair(
const _T1& __a,
const _T2& __b)
259 : first(__a), second(__b) { }
263 #if __cplusplus < 201103L 264 template<
typename _U1,
typename _U2>
269 template <
typename _U1,
typename _U2>
270 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
271 || !is_same<_T2, _U2>::value,
274 template<
typename _U1,
typename _U2,
typename 275 enable_if<_PCCFP<_U1, _U2>::template
276 _ConstructiblePair<_U1, _U2>()
278 _ImplicitlyConvertiblePair<_U1, _U2>(),
281 : first(__p.first), second(__p.second) { }
283 template<
typename _U1,
typename _U2,
typename 284 enable_if<_PCCFP<_U1, _U2>::template
285 _ConstructiblePair<_U1, _U2>()
287 _ImplicitlyConvertiblePair<_U1, _U2>(),
292 constexpr pair(
const pair&) =
default;
293 constexpr pair(pair&&) =
default;
296 template<
typename _U1,
typename 297 enable_if<_PCCP::template
298 _MoveCopyPair<true, _U1, _T2>(),
300 constexpr pair(_U1&& __x,
const _T2& __y)
301 : first(std::forward<_U1>(__x)), second(__y) { }
303 template<
typename _U1,
typename 304 enable_if<_PCCP::template
305 _MoveCopyPair<false, _U1, _T2>(),
307 explicit constexpr pair(_U1&& __x,
const _T2& __y)
308 : first(std::forward<_U1>(__x)), second(__y) { }
310 template<
typename _U2,
typename 311 enable_if<_PCCP::template
312 _CopyMovePair<true, _T1, _U2>(),
314 constexpr pair(
const _T1& __x, _U2&& __y)
315 : first(__x), second(std::forward<_U2>(__y)) { }
317 template<
typename _U2,
typename 318 enable_if<_PCCP::template
319 _CopyMovePair<false, _T1, _U2>(),
321 explicit pair(
const _T1& __x, _U2&& __y)
322 : first(__x), second(std::forward<_U2>(__y)) { }
324 template<
typename _U1,
typename _U2,
typename 325 enable_if<_PCCP::template
326 _MoveConstructiblePair<_U1, _U2>()
328 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
330 constexpr pair(_U1&& __x, _U2&& __y)
331 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
333 template<
typename _U1,
typename _U2,
typename 334 enable_if<_PCCP::template
335 _MoveConstructiblePair<_U1, _U2>()
337 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
339 explicit constexpr pair(_U1&& __x, _U2&& __y)
340 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
343 template<
typename _U1,
typename _U2,
typename 344 enable_if<_PCCFP<_U1, _U2>::template
345 _MoveConstructiblePair<_U1, _U2>()
347 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
350 : first(std::forward<_U1>(__p.
first)),
351 second(std::forward<_U2>(__p.
second)) { }
353 template<
typename _U1,
typename _U2,
typename 354 enable_if<_PCCFP<_U1, _U2>::template
355 _MoveConstructiblePair<_U1, _U2>()
357 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
360 : first(std::forward<_U1>(__p.
first)),
361 second(std::forward<_U2>(__p.
second)) { }
363 template<
typename... _Args1,
typename... _Args2>
367 operator=(
typename conditional<
368 __and_<is_copy_assignable<_T1>,
369 is_copy_assignable<_T2>>::value,
370 const pair&,
const __nonesuch_no_braces&>::type __p)
378 operator=(
typename conditional<
379 __not_<__and_<is_copy_assignable<_T1>,
380 is_copy_assignable<_T2>>>::value,
381 const pair&,
const __nonesuch_no_braces&>::type __p) =
delete;
384 operator=(
typename conditional<
385 __and_<is_move_assignable<_T1>,
386 is_move_assignable<_T2>>::value,
387 pair&&, __nonesuch_no_braces&&>::type __p)
388 noexcept(__and_<is_nothrow_move_assignable<_T1>,
389 is_nothrow_move_assignable<_T2>>::value)
391 first = std::forward<first_type>(__p.first);
392 second = std::forward<second_type>(__p.second);
396 template<
typename _U1,
typename _U2>
397 typename enable_if<__and_<is_assignable<_T1&, const _U1&>,
398 is_assignable<_T2&, const _U2&>>::value,
407 template<
typename _U1,
typename _U2>
408 typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
409 is_assignable<_T2&, _U2&&>>::value,
413 first = std::forward<_U1>(__p.
first);
414 second = std::forward<_U2>(__p.
second);
420 noexcept(__and_<__is_nothrow_swappable<_T1>,
421 __is_nothrow_swappable<_T2>>::value)
424 swap(first, __p.
first);
429 template<
typename... _Args1, std::size_t... _Indexes1,
430 typename... _Args2, std::size_t... _Indexes2>
432 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
436 #if __cpp_deduction_guides >= 201606 441 template<
typename _T1,
typename _T2>
442 inline _GLIBCXX_CONSTEXPR
bool 447 template<
typename _T1,
typename _T2>
448 inline _GLIBCXX_CONSTEXPR
bool 450 {
return __x.
first < __y.first
451 || (!(__y.first < __x.first) && __x.second < __y.second); }
454 template<
typename _T1,
typename _T2>
455 inline _GLIBCXX_CONSTEXPR
bool 457 {
return !(__x == __y); }
460 template<
typename _T1,
typename _T2>
461 inline _GLIBCXX_CONSTEXPR
bool 463 {
return __y < __x; }
466 template<
typename _T1,
typename _T2>
467 inline _GLIBCXX_CONSTEXPR
bool 469 {
return !(__y < __x); }
472 template<
typename _T1,
typename _T2>
473 inline _GLIBCXX_CONSTEXPR
bool 475 {
return !(__x < __y); }
477 #if __cplusplus >= 201103L 481 template<
typename _T1,
typename _T2>
483 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 485 typename enable_if<__and_<__is_swappable<_T1>,
486 __is_swappable<_T2>>::value>::type
491 noexcept(noexcept(__x.swap(__y)))
494 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 495 template<
typename _T1,
typename _T2>
496 typename enable_if<!__and_<__is_swappable<_T1>,
497 __is_swappable<_T2>>::value>::type
500 #endif // __cplusplus >= 201103L 514 #if __cplusplus >= 201103L 516 template<
typename _T1,
typename _T2>
518 typename __decay_and_strip<_T2>::__type>
521 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
522 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
524 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
527 template<
typename _T1,
typename _T2>
535 _GLIBCXX_END_NAMESPACE_VERSION
_T2 second
first is a copy of the first object
_GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct
piecewise_construct
Primary class template, tuple.
constexpr pair()
second is a copy of the second object
_T1 first
second_type is the second bound type
_PCC< true, _BiIter, _BiIter > _PCCP
_T2 second_type
first_type is the first bound type
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.
Struct holding two objects of arbitrary type.
_PCC<!is_same< _BiIter, _U1 >::value||!is_same< _BiIter, _U2 >::value, _BiIter, _BiIter > _PCCFP