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;
193 template<
typename _T1,
typename _T2>
196 typedef _T1 first_type;
206 #if __cplusplus >= 201103L 207 template <
typename _U1 = _T1,
209 typename enable_if<__and_<
210 __is_implicitly_default_constructible<_U1>,
211 __is_implicitly_default_constructible<_U2>>
212 ::value,
bool>::type =
true>
215 : first(), second() { }
217 #if __cplusplus >= 201103L 218 template <
typename _U1 = _T1,
220 typename enable_if<__and_<
221 is_default_constructible<_U1>,
222 is_default_constructible<_U2>,
224 __and_<__is_implicitly_default_constructible<_U1>,
225 __is_implicitly_default_constructible<_U2>>>>
226 ::value,
bool>::type =
false>
227 explicit constexpr
pair()
228 : first(), second() { }
232 #if __cplusplus < 201103L 233 pair(
const _T1& __a,
const _T2& __b)
234 : first(__a), second(__b) { }
239 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 240 enable_if<_PCCP::template
241 _ConstructiblePair<_U1, _U2>()
243 _ImplicitlyConvertiblePair<_U1, _U2>(),
245 constexpr pair(
const _T1& __a,
const _T2& __b)
246 : first(__a), second(__b) { }
248 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 249 enable_if<_PCCP::template
250 _ConstructiblePair<_U1, _U2>()
252 _ImplicitlyConvertiblePair<_U1, _U2>(),
254 explicit constexpr pair(
const _T1& __a,
const _T2& __b)
255 : first(__a), second(__b) { }
259 #if __cplusplus < 201103L 260 template<
typename _U1,
typename _U2>
265 template <
typename _U1,
typename _U2>
266 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
267 || !is_same<_T2, _U2>::value,
270 template<
typename _U1,
typename _U2,
typename 271 enable_if<_PCCFP<_U1, _U2>::template
272 _ConstructiblePair<_U1, _U2>()
274 _ImplicitlyConvertiblePair<_U1, _U2>(),
277 : first(__p.first), second(__p.second) { }
279 template<
typename _U1,
typename _U2,
typename 280 enable_if<_PCCFP<_U1, _U2>::template
281 _ConstructiblePair<_U1, _U2>()
283 _ImplicitlyConvertiblePair<_U1, _U2>(),
288 constexpr pair(
const pair&) =
default;
289 constexpr pair(pair&&) =
default;
292 template<
typename _U1,
typename 293 enable_if<_PCCP::template
294 _MoveCopyPair<true, _U1, _T2>(),
296 constexpr pair(_U1&& __x,
const _T2& __y)
297 : first(std::forward<_U1>(__x)), second(__y) { }
299 template<
typename _U1,
typename 300 enable_if<_PCCP::template
301 _MoveCopyPair<false, _U1, _T2>(),
303 explicit constexpr pair(_U1&& __x,
const _T2& __y)
304 : first(std::forward<_U1>(__x)), second(__y) { }
306 template<
typename _U2,
typename 307 enable_if<_PCCP::template
308 _CopyMovePair<true, _T1, _U2>(),
310 constexpr pair(
const _T1& __x, _U2&& __y)
311 : first(__x), second(std::forward<_U2>(__y)) { }
313 template<
typename _U2,
typename 314 enable_if<_PCCP::template
315 _CopyMovePair<false, _T1, _U2>(),
317 explicit pair(
const _T1& __x, _U2&& __y)
318 : first(__x), second(std::forward<_U2>(__y)) { }
320 template<
typename _U1,
typename _U2,
typename 321 enable_if<_PCCP::template
322 _MoveConstructiblePair<_U1, _U2>()
324 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
326 constexpr pair(_U1&& __x, _U2&& __y)
327 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
329 template<
typename _U1,
typename _U2,
typename 330 enable_if<_PCCP::template
331 _MoveConstructiblePair<_U1, _U2>()
333 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
335 explicit constexpr pair(_U1&& __x, _U2&& __y)
336 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
339 template<
typename _U1,
typename _U2,
typename 340 enable_if<_PCCFP<_U1, _U2>::template
341 _MoveConstructiblePair<_U1, _U2>()
343 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
346 : first(std::forward<_U1>(__p.
first)),
347 second(std::forward<_U2>(__p.
second)) { }
349 template<
typename _U1,
typename _U2,
typename 350 enable_if<_PCCFP<_U1, _U2>::template
351 _MoveConstructiblePair<_U1, _U2>()
353 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
356 : first(std::forward<_U1>(__p.
first)),
357 second(std::forward<_U2>(__p.
second)) { }
359 template<
typename... _Args1,
typename... _Args2>
363 operator=(
typename conditional<
364 __and_<is_copy_assignable<_T1>,
365 is_copy_assignable<_T2>>::value,
366 const pair&,
const __wrap_nonesuch&>::type __p)
374 operator=(
typename conditional<
375 __not_<__and_<is_copy_assignable<_T1>,
376 is_copy_assignable<_T2>>>::value,
377 const pair&,
const __wrap_nonesuch&>::type __p) =
delete;
380 operator=(
typename conditional<
381 __and_<is_move_assignable<_T1>,
382 is_move_assignable<_T2>>::value,
383 pair&&, __wrap_nonesuch&&>::type __p)
384 noexcept(__and_<is_nothrow_move_assignable<_T1>,
385 is_nothrow_move_assignable<_T2>>::value)
387 first = std::forward<first_type>(__p.first);
388 second = std::forward<second_type>(__p.second);
392 template<
typename _U1,
typename _U2>
393 typename enable_if<__and_<is_assignable<_T1&, const _U1&>,
394 is_assignable<_T2&, const _U2&>>::value,
403 template<
typename _U1,
typename _U2>
404 typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
405 is_assignable<_T2&, _U2&&>>::value,
409 first = std::forward<_U1>(__p.
first);
410 second = std::forward<_U2>(__p.
second);
416 noexcept(__is_nothrow_swappable<_T1>::value
417 && __is_nothrow_swappable<_T2>::value)
420 swap(first, __p.
first);
425 template<
typename... _Args1, std::size_t... _Indexes1,
426 typename... _Args2, std::size_t... _Indexes2>
428 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
433 template<
typename _T1,
typename _T2>
434 inline _GLIBCXX_CONSTEXPR
bool 439 template<
typename _T1,
typename _T2>
440 inline _GLIBCXX_CONSTEXPR
bool 442 {
return __x.
first < __y.first
443 || (!(__y.first < __x.first) && __x.second < __y.second); }
446 template<
typename _T1,
typename _T2>
447 inline _GLIBCXX_CONSTEXPR
bool 449 {
return !(__x == __y); }
452 template<
typename _T1,
typename _T2>
453 inline _GLIBCXX_CONSTEXPR
bool 455 {
return __y < __x; }
458 template<
typename _T1,
typename _T2>
459 inline _GLIBCXX_CONSTEXPR
bool 461 {
return !(__y < __x); }
464 template<
typename _T1,
typename _T2>
465 inline _GLIBCXX_CONSTEXPR
bool 467 {
return !(__x < __y); }
469 #if __cplusplus >= 201103L 473 template<
typename _T1,
typename _T2>
476 noexcept(noexcept(__x.swap(__y)))
492 #if __cplusplus >= 201103L 494 template<
typename _T1,
typename _T2>
496 typename __decay_and_strip<_T2>::__type>
499 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
500 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
502 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
505 template<
typename _T1,
typename _T2>
513 _GLIBCXX_END_NAMESPACE_VERSION
_PCC<!is_same< _BiIter, _U1 >::value||!is_same< _BiIter, _U2 >::value, _BiIter, _BiIter > _PCCFP
constexpr piecewise_construct_t piecewise_construct
piecewise_construct
_PCC< true, _BiIter, _BiIter > _PCCP
Struct holding two objects of arbitrary type.
Primary class template, tuple.
_T1 first
second_type is the second bound type
ISO C++ entities toplevel namespace is std.
_T2 second
first is a copy of the first object
_T2 second_type
first_type is the first bound type
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.
constexpr pair()
second is a copy of the second object