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()
189 template<
typename _T1,
typename _T2>
192 typedef _T1 first_type;
202 #if __cplusplus >= 201103L 203 template <
typename _U1 = _T1,
205 typename enable_if<__and_<
206 __is_implicitly_default_constructible<_U1>,
207 __is_implicitly_default_constructible<_U2>>
208 ::value,
bool>::type =
true>
211 : first(), second() { }
213 #if __cplusplus >= 201103L 214 template <
typename _U1 = _T1,
216 typename enable_if<__and_<
217 is_default_constructible<_U1>,
218 is_default_constructible<_U2>,
220 __and_<__is_implicitly_default_constructible<_U1>,
221 __is_implicitly_default_constructible<_U2>>>>
222 ::value,
bool>::type =
false>
223 explicit constexpr
pair()
224 : first(), second() { }
228 #if __cplusplus < 201103L 229 pair(
const _T1& __a,
const _T2& __b)
230 : first(__a), second(__b) { }
235 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 236 enable_if<_PCCP::template
237 _ConstructiblePair<_U1, _U2>()
239 _ImplicitlyConvertiblePair<_U1, _U2>(),
241 constexpr pair(
const _T1& __a,
const _T2& __b)
242 : first(__a), second(__b) { }
244 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 245 enable_if<_PCCP::template
246 _ConstructiblePair<_U1, _U2>()
248 _ImplicitlyConvertiblePair<_U1, _U2>(),
250 explicit constexpr pair(
const _T1& __a,
const _T2& __b)
251 : first(__a), second(__b) { }
255 #if __cplusplus < 201103L 256 template<
typename _U1,
typename _U2>
261 template <
typename _U1,
typename _U2>
262 using _PCCFP = _PCC<!is_same<_T1, _U1>::value
263 || !is_same<_T2, _U2>::value,
266 template<
typename _U1,
typename _U2,
typename 267 enable_if<_PCCFP<_U1, _U2>::template
268 _ConstructiblePair<_U1, _U2>()
270 _ImplicitlyConvertiblePair<_U1, _U2>(),
273 : first(__p.first), second(__p.second) { }
275 template<
typename _U1,
typename _U2,
typename 276 enable_if<_PCCFP<_U1, _U2>::template
277 _ConstructiblePair<_U1, _U2>()
279 _ImplicitlyConvertiblePair<_U1, _U2>(),
284 constexpr pair(
const pair&) =
default;
285 constexpr pair(pair&&) =
default;
288 template<
typename _U1,
typename 289 enable_if<_PCCP::template
290 _MoveCopyPair<true, _U1, _T2>(),
292 constexpr pair(_U1&& __x,
const _T2& __y)
293 : first(std::forward<_U1>(__x)), second(__y) { }
295 template<
typename _U1,
typename 296 enable_if<_PCCP::template
297 _MoveCopyPair<false, _U1, _T2>(),
299 explicit constexpr pair(_U1&& __x,
const _T2& __y)
300 : first(std::forward<_U1>(__x)), second(__y) { }
302 template<
typename _U2,
typename 303 enable_if<_PCCP::template
304 _CopyMovePair<true, _T1, _U2>(),
306 constexpr pair(
const _T1& __x, _U2&& __y)
307 : first(__x), second(std::forward<_U2>(__y)) { }
309 template<
typename _U2,
typename 310 enable_if<_PCCP::template
311 _CopyMovePair<false, _T1, _U2>(),
313 explicit pair(
const _T1& __x, _U2&& __y)
314 : first(__x), second(std::forward<_U2>(__y)) { }
316 template<
typename _U1,
typename _U2,
typename 317 enable_if<_PCCP::template
318 _MoveConstructiblePair<_U1, _U2>()
320 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
322 constexpr pair(_U1&& __x, _U2&& __y)
323 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
325 template<
typename _U1,
typename _U2,
typename 326 enable_if<_PCCP::template
327 _MoveConstructiblePair<_U1, _U2>()
329 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
331 explicit constexpr pair(_U1&& __x, _U2&& __y)
332 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
335 template<
typename _U1,
typename _U2,
typename 336 enable_if<_PCCFP<_U1, _U2>::template
337 _MoveConstructiblePair<_U1, _U2>()
339 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
342 : first(std::forward<_U1>(__p.
first)),
343 second(std::forward<_U2>(__p.
second)) { }
345 template<
typename _U1,
typename _U2,
typename 346 enable_if<_PCCFP<_U1, _U2>::template
347 _MoveConstructiblePair<_U1, _U2>()
349 _ImplicitlyMoveConvertiblePair<_U1, _U2>(),
352 : first(std::forward<_U1>(__p.
first)),
353 second(std::forward<_U2>(__p.
second)) { }
355 template<
typename... _Args1,
typename... _Args2>
359 operator=(
typename conditional<
360 __and_<is_copy_assignable<_T1>,
361 is_copy_assignable<_T2>>::value,
362 const pair&,
const __nonesuch&>::type __p)
370 operator=(
typename conditional<
371 __not_<__and_<is_copy_assignable<_T1>,
372 is_copy_assignable<_T2>>>::value,
373 const pair&,
const __nonesuch&>::type __p) =
delete;
376 operator=(
typename conditional<
377 __and_<is_move_assignable<_T1>,
378 is_move_assignable<_T2>>::value,
379 pair&&, __nonesuch&&>::type __p)
380 noexcept(__and_<is_nothrow_move_assignable<_T1>,
381 is_nothrow_move_assignable<_T2>>::value)
383 first = std::forward<first_type>(__p.first);
384 second = std::forward<second_type>(__p.second);
388 template<
typename _U1,
typename _U2>
389 typename enable_if<__and_<is_assignable<_T1&, const _U1&>,
390 is_assignable<_T2&, const _U2&>>::value,
399 template<
typename _U1,
typename _U2>
400 typename enable_if<__and_<is_assignable<_T1&, _U1&&>,
401 is_assignable<_T2&, _U2&&>>::value,
405 first = std::forward<_U1>(__p.
first);
406 second = std::forward<_U2>(__p.
second);
412 noexcept(__is_nothrow_swappable<_T1>::value
413 && __is_nothrow_swappable<_T2>::value)
416 swap(first, __p.
first);
421 template<
typename... _Args1, std::size_t... _Indexes1,
422 typename... _Args2, std::size_t... _Indexes2>
424 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
429 template<
typename _T1,
typename _T2>
430 inline _GLIBCXX_CONSTEXPR
bool 435 template<
typename _T1,
typename _T2>
436 inline _GLIBCXX_CONSTEXPR
bool 438 {
return __x.
first < __y.first
439 || (!(__y.first < __x.first) && __x.second < __y.second); }
442 template<
typename _T1,
typename _T2>
443 inline _GLIBCXX_CONSTEXPR
bool 445 {
return !(__x == __y); }
448 template<
typename _T1,
typename _T2>
449 inline _GLIBCXX_CONSTEXPR
bool 451 {
return __y < __x; }
454 template<
typename _T1,
typename _T2>
455 inline _GLIBCXX_CONSTEXPR
bool 457 {
return !(__y < __x); }
460 template<
typename _T1,
typename _T2>
461 inline _GLIBCXX_CONSTEXPR
bool 463 {
return !(__x < __y); }
465 #if __cplusplus >= 201103L 469 template<
typename _T1,
typename _T2>
472 noexcept(noexcept(__x.swap(__y)))
488 #if __cplusplus >= 201103L 490 template<
typename _T1,
typename _T2>
492 typename __decay_and_strip<_T2>::__type>
495 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
496 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
498 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
501 template<
typename _T1,
typename _T2>
509 _GLIBCXX_END_NAMESPACE_VERSION
_T2 second
first is a copy of the first object
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
constexpr piecewise_construct_t piecewise_construct
piecewise_construct
_T2 second_type
first_type is the first bound type
Struct holding two objects of arbitrary 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.
ISO C++ entities toplevel namespace is std.
_PCC<!is_same< _BiIter, _U1 >::value||!is_same< _BiIter, _U2 >::value, _BiIter, _BiIter > _PCCFP