61 #if __cplusplus >= 201103L
65 namespace std _GLIBCXX_VISIBILITY(default)
67 _GLIBCXX_BEGIN_NAMESPACE_VERSION
74 #if __cplusplus >= 201103L
85 template<std::size_t...>
93 template <
bool,
typename _T1,
typename _T2>
96 template <
typename _U1,
typename _U2>
97 static constexpr
bool _ConstructiblePair()
99 return __and_<is_constructible<_T1, const _U1&>,
100 is_constructible<_T2, const _U2&>>::value;
103 template <
typename _U1,
typename _U2>
104 static constexpr
bool _ImplicitlyConvertiblePair()
106 return __and_<is_convertible<const _U1&, _T1>,
107 is_convertible<const _U2&, _T2>>::value;
110 template <
typename _U1,
typename _U2>
111 static constexpr
bool _MoveConstructiblePair()
113 return __and_<is_constructible<_T1, _U1&&>,
114 is_constructible<_T2, _U2&&>>::value;
117 template <
typename _U1,
typename _U2>
118 static constexpr
bool _ImplicitlyMoveConvertiblePair()
120 return __and_<is_convertible<_U1&&, _T1>,
121 is_convertible<_U2&&, _T2>>::value;
124 template <
bool __implicit,
typename _U1,
typename _U2>
125 static constexpr
bool _CopyMovePair()
127 using __do_converts = __and_<is_convertible<const _U1&, _T1>,
128 is_convertible<_U2&&, _T2>>;
129 using __converts =
typename conditional<__implicit,
131 __not_<__do_converts>>::type;
132 return __and_<is_constructible<_T1, const _U1&>,
133 is_constructible<_T2, _U2&&>,
138 template <
bool __implicit,
typename _U1,
typename _U2>
139 static constexpr
bool _MoveCopyPair()
141 using __do_converts = __and_<is_convertible<_U1&&, _T1>,
142 is_convertible<const _U2&, _T2>>;
143 using __converts =
typename conditional<__implicit,
145 __not_<__do_converts>>::type;
146 return __and_<is_constructible<_T1, _U1&&>,
147 is_constructible<_T2, const _U2&&>,
153 template <
typename _T1,
typename _T2>
154 struct _PCC<false, _T1, _T2>
156 template <
typename _U1,
typename _U2>
157 static constexpr
bool _ConstructiblePair()
162 template <
typename _U1,
typename _U2>
163 static constexpr
bool _ImplicitlyConvertiblePair()
168 template <
typename _U1,
typename _U2>
169 static constexpr
bool _MoveConstructiblePair()
174 template <
typename _U1,
typename _U2>
175 static constexpr
bool _ImplicitlyMoveConvertiblePair()
181 struct __wrap_nonesuch : std::__nonesuch {
182 explicit __wrap_nonesuch(
const __nonesuch&) =
delete;
186 template<
typename _U1,
typename _U2>
class __pair_base
188 #if __cplusplus >= 201103L
189 template<
typename _T1,
typename _T2>
friend struct pair;
190 __pair_base() =
default;
191 ~__pair_base() =
default;
192 __pair_base(
const __pair_base&) =
default;
193 __pair_base& operator=(
const __pair_base&) =
delete;
203 template<
typename _T1,
typename _T2>
205 :
private __pair_base<_T1, _T2>
207 typedef _T1 first_type;
217 #if __cplusplus >= 201103L
218 template <
typename _U1 = _T1,
220 typename enable_if<__and_<
221 __is_implicitly_default_constructible<_U1>,
222 __is_implicitly_default_constructible<_U2>>
223 ::value,
bool>::type =
true>
228 #if __cplusplus >= 201103L
229 template <
typename _U1 = _T1,
231 typename enable_if<__and_<
232 is_default_constructible<_U1>,
233 is_default_constructible<_U2>,
235 __and_<__is_implicitly_default_constructible<_U1>,
236 __is_implicitly_default_constructible<_U2>>>>
237 ::value,
bool>::type =
false>
238 explicit constexpr
pair()
243 #if __cplusplus < 201103L
244 pair(
const _T1& __a,
const _T2& __b)
250 template<
typename _U1 = _T1,
typename _U2=_T2,
typename
251 enable_if<_PCCP::template
252 _ConstructiblePair<_U1, _U2>()
254 _ImplicitlyConvertiblePair<_U1, _U2>(),
256 constexpr
pair(
const _T1& __a,
const _T2& __b)
259 template<
typename _U1 = _T1,
typename _U2=_T2,
typename
260 enable_if<_PCCP::template
261 _ConstructiblePair<_U1, _U2>()
263 _ImplicitlyConvertiblePair<_U1, _U2>(),
265 explicit constexpr
pair(
const _T1& __a,
const _T2& __b)
270 #if __cplusplus < 201103L
271 template<
typename _U1,
typename _U2>
272 pair(
const pair<_U1, _U2>& __p)
276 template <
typename _U1,
typename _U2>
277 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
278 || !is_same<_T2, _U2>::value,
281 template<
typename _U1,
typename _U2,
typename
282 enable_if<_PCCFP<_U1, _U2>::template
283 _ConstructiblePair<_U1, _U2>()
285 _ImplicitlyConvertiblePair<_U1, _U2>(),
290 template<
typename _U1,
typename _U2,
typename
291 enable_if<_PCCFP<_U1, _U2>::template
292 _ConstructiblePair<_U1, _U2>()
293 && !_PCCFP<_U1, _U2>::template
294 _ImplicitlyConvertiblePair<_U1, _U2>(),
299 constexpr
pair(
const pair&) =
default;
303 template<
typename _U1,
typename
304 enable_if<_PCCP::template
305 _MoveCopyPair<true, _U1, _T2>(),
307 constexpr
pair(_U1&& __x,
const _T2& __y)
310 template<
typename _U1,
typename
311 enable_if<_PCCP::template
312 _MoveCopyPair<false, _U1, _T2>(),
314 explicit constexpr
pair(_U1&& __x,
const _T2& __y)
317 template<
typename _U2,
typename
318 enable_if<_PCCP::template
319 _CopyMovePair<true, _T1, _U2>(),
321 constexpr
pair(
const _T1& __x, _U2&& __y)
324 template<
typename _U2,
typename
325 enable_if<_PCCP::template
326 _CopyMovePair<false, _T1, _U2>(),
328 explicit pair(
const _T1& __x, _U2&& __y)
331 template<
typename _U1,
typename _U2,
typename
332 enable_if<_PCCP::template
333 _MoveConstructiblePair<_U1, _U2>()
335 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
337 constexpr
pair(_U1&& __x, _U2&& __y)
340 template<
typename _U1,
typename _U2,
typename
341 enable_if<_PCCP::template
342 _MoveConstructiblePair<_U1, _U2>()
344 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
346 explicit constexpr
pair(_U1&& __x, _U2&& __y)
350 template<
typename _U1,
typename _U2,
typename
351 enable_if<_PCCFP<_U1, _U2>::template
352 _MoveConstructiblePair<_U1, _U2>()
353 && _PCCFP<_U1, _U2>::template
354 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
356 constexpr
pair(pair<_U1, _U2>&& __p)
360 template<
typename _U1,
typename _U2,
typename
361 enable_if<_PCCFP<_U1, _U2>::template
362 _MoveConstructiblePair<_U1, _U2>()
363 && !_PCCFP<_U1, _U2>::template
364 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
366 explicit constexpr
pair(pair<_U1, _U2>&& __p)
370 template<
typename... _Args1,
typename... _Args2>
371 pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>);
374 operator=(
typename conditional<
375 __and_<is_copy_assignable<_T1>,
376 is_copy_assignable<_T2>>::value,
377 const pair&,
const __wrap_nonesuch&>::type __p)
385 operator=(
typename conditional<
386 __and_<is_move_assignable<_T1>,
387 is_move_assignable<_T2>>::value,
388 pair&&, __wrap_nonesuch&&>::type __p)
389 noexcept(__and_<is_nothrow_move_assignable<_T1>,
390 is_nothrow_move_assignable<_T2>>::value)
392 first = std::forward<first_type>(__p.first);
393 second = std::forward<second_type>(__p.second);
397 template<
typename _U1,
typename _U2>
398 typename enable_if<__and_<is_assignable<_T1&, const _U1&>,
399 is_assignable<_T2&, const _U2&>>::value,
401 operator=(
const pair<_U1, _U2>& __p)
408 template<
typename _U1,
typename _U2>
409 typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
410 is_assignable<_T2&, _U2&&>>::value,
412 operator=(pair<_U1, _U2>&& __p)
414 first = std::forward<_U1>(__p.first);
415 second = std::forward<_U2>(__p.second);
421 noexcept(__is_nothrow_swappable<_T1>::value
422 && __is_nothrow_swappable<_T2>::value)
425 swap(
first, __p.first);
430 template<
typename... _Args1, std::size_t... _Indexes1,
431 typename... _Args2, std::size_t... _Indexes2>
432 pair(tuple<_Args1...>&, tuple<_Args2...>&,
433 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
438 template<
typename _T1,
typename _T2>
439 inline _GLIBCXX_CONSTEXPR
bool
444 template<
typename _T1,
typename _T2>
445 inline _GLIBCXX_CONSTEXPR
bool
447 {
return __x.
first < __y.first
448 || (!(__y.first < __x.first) && __x.second < __y.second); }
451 template<
typename _T1,
typename _T2>
452 inline _GLIBCXX_CONSTEXPR
bool
454 {
return !(__x == __y); }
457 template<
typename _T1,
typename _T2>
458 inline _GLIBCXX_CONSTEXPR
bool
460 {
return __y < __x; }
463 template<
typename _T1,
typename _T2>
464 inline _GLIBCXX_CONSTEXPR
bool
466 {
return !(__y < __x); }
469 template<
typename _T1,
typename _T2>
470 inline _GLIBCXX_CONSTEXPR
bool
472 {
return !(__x < __y); }
474 #if __cplusplus >= 201103L
478 template<
typename _T1,
typename _T2>
481 noexcept(noexcept(__x.swap(__y)))
497 #if __cplusplus >= 201103L
499 template<
typename _T1,
typename _T2>
500 constexpr pair<typename __decay_and_strip<_T1>::__type,
501 typename __decay_and_strip<_T2>::__type>
504 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
505 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
507 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
510 template<
typename _T1,
typename _T2>
511 inline pair<_T1, _T2>
513 {
return pair<_T1, _T2>(__x, __y); }
518 _GLIBCXX_END_NAMESPACE_VERSION
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
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
_PCC<!is_same< _T1, _U1 >::value||!is_same< _T2, _U2 >::value, _T1, _T2 > _PCCFP
Struct holding two objects of arbitrary type.
Primary class template, tuple.
_PCC< true, _BiIter, _BiIter > _PCCP
constexpr piecewise_construct_t piecewise_construct
piecewise_construct
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.
_T2 second
first is a copy of the first object