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 <
typename _T1,
typename _T2,
typename _U1,
typename _U2>
94 constexpr
bool _ConstructiblePair()
96 return __and_<__or_<is_same<typename decay<_T1>::type,
97 typename decay<_U1>::type>,
98 is_constructible<_T1, const _U1&>>,
99 __or_<is_same<typename decay<_T2>::type,
100 typename decay<_U2>::type>,
101 is_constructible<_T2, const _U2&>>>::value;
104 template <
typename _T1,
typename _T2,
typename _U1,
typename _U2>
105 constexpr
bool _ImplicitlyConvertiblePair()
107 return __and_<__or_<is_same<typename decay<_T1>::type,
108 typename decay<_U1>::type>,
109 is_convertible<const _U1&, _T1>>,
110 __or_<is_same<typename decay<_T2>::type,
111 typename decay<_U2>::type>,
112 is_convertible<const _U2&, _T2>>>::value;
115 template <
typename _T1,
typename _T2,
typename _U1,
typename _U2>
116 constexpr
bool _MoveConstructiblePair()
118 return __and_<__or_<is_same<typename decay<_T1>::type,
119 typename decay<_U1>::type>,
120 is_constructible<_T1, _U1&&>>,
121 __or_<is_same<typename decay<_T2>::type,
122 typename decay<_U2>::type>,
123 is_constructible<_T2, _U2&&>>>::value;
126 template <
typename _T1,
typename _T2,
typename _U1,
typename _U2>
127 constexpr
bool _ImplicitlyMoveConvertiblePair()
129 return __and_<__or_<is_same<typename decay<_T1>::type,
130 typename decay<_U1>::type>,
131 is_convertible<_U1&&, _T1>>,
132 __or_<is_same<typename decay<_T2>::type,
133 typename decay<_U2>::type>,
134 is_convertible<_U2&&, _T2>>>::value;
146 template<
typename _T1,
typename _T2>
149 typedef _T1 first_type;
159 #if __cplusplus >= 201103L 160 template <
typename _U1 = _T1,
162 typename enable_if<__and_<
163 __is_implicitly_default_constructible<_U1>,
164 __is_implicitly_default_constructible<_U2>>
165 ::value,
bool>::type =
true>
168 : first(), second() { }
170 #if __cplusplus >= 201103L 171 template <
typename _U1 = _T1,
173 typename enable_if<__and_<
174 is_default_constructible<_U1>,
175 is_default_constructible<_U2>,
177 __and_<__is_implicitly_default_constructible<_U1>,
178 __is_implicitly_default_constructible<_U2>>>>
179 ::value,
bool>::type =
false>
180 explicit constexpr
pair()
181 : first(), second() { }
185 #if __cplusplus < 201103L 186 pair(
const _T1& __a,
const _T2& __b)
187 : first(__a), second(__b) { }
189 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 190 enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>()
191 && _ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(),
193 constexpr
pair(
const _T1& __a,
const _T2& __b)
194 : first(__a), second(__b) { }
196 template<
typename _U1 = _T1,
typename _U2=_T2,
typename 197 enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>()
198 && !_ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(),
200 explicit constexpr pair(
const _T1& __a,
const _T2& __b)
201 : first(__a), second(__b) { }
205 #if __cplusplus < 201103L 206 template<
typename _U1,
typename _U2>
210 template<
typename _U1,
typename _U2,
typename 211 enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>()
212 && _ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(),
215 : first(__p.first), second(__p.second) { }
217 template<
typename _U1,
typename _U2,
typename 218 enable_if<_ConstructiblePair<_T1, _T2, _U1, _U2>()
219 && !_ImplicitlyConvertiblePair<_T1, _T2, _U1, _U2>(),
224 constexpr pair(
const pair&) =
default;
225 constexpr pair(pair&&) =
default;
228 template<
typename _U1,
typename 229 enable_if<_ConstructiblePair<_T2, _T2, _T2, _T2>()
230 && _MoveConstructiblePair<_T1, _T2, _U1, _T2>()
231 && _ImplicitlyConvertiblePair<_T2, _T2, _T2, _T2>()
232 && _ImplicitlyMoveConvertiblePair<_T1, _T2,
235 constexpr pair(_U1&& __x,
const _T2& __y)
236 : first(std::forward<_U1>(__x)), second(__y) { }
238 template<
typename _U1,
typename 239 enable_if<_ConstructiblePair<_T2, _T2, _T2, _T2>()
240 && _MoveConstructiblePair<_T1, _T2, _U1, _T2>()
241 && (!_ImplicitlyConvertiblePair<_T2, _T2, _T2, _T2>()
242 || !_ImplicitlyMoveConvertiblePair<_T1, _T2,
245 explicit constexpr pair(_U1&& __x,
const _T2& __y)
246 : first(std::forward<_U1>(__x)), second(__y) { }
248 template<
typename _U2,
typename 249 enable_if<_ConstructiblePair<_T1, _T1, _T1, _T1>()
250 && _MoveConstructiblePair<_T1, _T2, _T1, _U2>()
251 && _ImplicitlyConvertiblePair<_T1, _T1, _T1, _T1>()
252 && _ImplicitlyMoveConvertiblePair<_T1, _T2,
255 constexpr pair(
const _T1& __x, _U2&& __y)
256 : first(__x), second(std::forward<_U2>(__y)) { }
258 template<
typename _U2,
typename 259 enable_if<_ConstructiblePair<_T1, _T1, _T1, _T1>()
260 && _MoveConstructiblePair<_T1, _T2, _T1, _U2>()
261 && (!_ImplicitlyConvertiblePair<_T1, _T1, _T1, _T1>()
262 || !_ImplicitlyMoveConvertiblePair<_T1, _T2,
265 explicit pair(
const _T1& __x, _U2&& __y)
266 : first(__x), second(std::forward<_U2>(__y)) { }
268 template<
typename _U1,
typename _U2,
typename 269 enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>()
270 && _ImplicitlyMoveConvertiblePair<_T1, _T2,
273 constexpr pair(_U1&& __x, _U2&& __y)
274 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
276 template<
typename _U1,
typename _U2,
typename 277 enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>()
278 && !_ImplicitlyMoveConvertiblePair<_T1, _T2,
281 explicit constexpr pair(_U1&& __x, _U2&& __y)
282 : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
285 template<
typename _U1,
typename _U2,
typename 286 enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>()
287 && _ImplicitlyMoveConvertiblePair<_T1, _T2,
291 : first(std::forward<_U1>(__p.
first)),
292 second(std::forward<_U2>(__p.
second)) { }
294 template<
typename _U1,
typename _U2,
typename 295 enable_if<_MoveConstructiblePair<_T1, _T2, _U1, _U2>()
296 && !_ImplicitlyMoveConvertiblePair<_T1, _T2,
300 : first(std::forward<_U1>(__p.
first)),
301 second(std::forward<_U2>(__p.
second)) { }
303 template<
typename... _Args1,
typename... _Args2>
307 operator=(
const pair& __p)
315 operator=(pair&& __p)
316 noexcept(__and_<is_nothrow_move_assignable<_T1>,
317 is_nothrow_move_assignable<_T2>>::value)
319 first = std::forward<first_type>(__p.
first);
320 second = std::forward<second_type>(__p.
second);
324 template<
typename _U1,
typename _U2>
333 template<
typename _U1,
typename _U2>
337 first = std::forward<_U1>(__p.
first);
338 second = std::forward<_U2>(__p.
second);
344 noexcept(__is_nothrow_swappable<_T1>::value
345 && __is_nothrow_swappable<_T2>::value)
348 swap(first, __p.
first);
353 template<
typename... _Args1, std::size_t... _Indexes1,
354 typename... _Args2, std::size_t... _Indexes2>
356 _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
361 template<
typename _T1,
typename _T2>
362 inline _GLIBCXX_CONSTEXPR
bool 367 template<
typename _T1,
typename _T2>
368 inline _GLIBCXX_CONSTEXPR
bool 370 {
return __x.
first < __y.first
371 || (!(__y.first < __x.first) && __x.second < __y.second); }
374 template<
typename _T1,
typename _T2>
375 inline _GLIBCXX_CONSTEXPR
bool 377 {
return !(__x == __y); }
380 template<
typename _T1,
typename _T2>
381 inline _GLIBCXX_CONSTEXPR
bool 383 {
return __y < __x; }
386 template<
typename _T1,
typename _T2>
387 inline _GLIBCXX_CONSTEXPR
bool 389 {
return !(__y < __x); }
392 template<
typename _T1,
typename _T2>
393 inline _GLIBCXX_CONSTEXPR
bool 395 {
return !(__x < __y); }
397 #if __cplusplus >= 201103L 401 template<
typename _T1,
typename _T2>
404 noexcept(noexcept(__x.swap(__y)))
420 #if __cplusplus >= 201103L 422 template<
typename _T1,
typename _T2>
424 typename __decay_and_strip<_T2>::__type>
427 typedef typename __decay_and_strip<_T1>::__type __ds_type1;
428 typedef typename __decay_and_strip<_T2>::__type __ds_type2;
430 return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y));
433 template<
typename _T1,
typename _T2>
441 _GLIBCXX_END_NAMESPACE_VERSION
_T2 second
first is a copy of the first object
ISO C++ entities toplevel namespace is std.
Primary class template, tuple.
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
constexpr pair(const _T1 &__a, const _T2 &__b)
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.
constexpr pair(const pair< _U1, _U2 > &__p)
constexpr piecewise_construct_t piecewise_construct
piecewise_construct