blob: 94876c91c028910236412b8e49d9915df804cdef [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:161// -*- C++ -*-
2//===--------------------------- tuple ------------------------------------===//
3//
Howard Hinnantf5256e12010-05-11 21:36:014// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:165//
6// This file is distributed under the University of Illinois Open Source
7// License. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_TUPLE
12#define _LIBCPP_TUPLE
13
14/*
15 tuple synopsis
16
17namespace std
18{
19
20template <class... T>
21class tuple {
22public:
23 constexpr tuple();
Marshall Clowda0a0e82013-07-22 16:02:1924 explicit tuple(const T&...); // constexpr in C++14
Howard Hinnantbc8d3f92010-05-11 19:42:1625 template <class... U>
Marshall Clowda0a0e82013-07-22 16:02:1926 explicit tuple(U&&...); // constexpr in C++14
Howard Hinnantbc8d3f92010-05-11 19:42:1627 tuple(const tuple&) = default;
Howard Hinnanta5e01212011-05-27 19:08:1828 tuple(tuple&&) = default;
Howard Hinnantbc8d3f92010-05-11 19:42:1629 template <class... U>
Marshall Clowda0a0e82013-07-22 16:02:1930 tuple(const tuple<U...>&); // constexpr in C++14
Howard Hinnantbc8d3f92010-05-11 19:42:1631 template <class... U>
Marshall Clowda0a0e82013-07-22 16:02:1932 tuple(tuple<U...>&&); // constexpr in C++14
Howard Hinnantbc8d3f92010-05-11 19:42:1633 template <class U1, class U2>
Marshall Clowda0a0e82013-07-22 16:02:1934 tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14
Howard Hinnantbc8d3f92010-05-11 19:42:1635 template <class U1, class U2>
Marshall Clowda0a0e82013-07-22 16:02:1936 tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++14
Howard Hinnantbc8d3f92010-05-11 19:42:1637
38 // allocator-extended constructors
39 template <class Alloc>
40 tuple(allocator_arg_t, const Alloc& a);
41 template <class Alloc>
42 tuple(allocator_arg_t, const Alloc& a, const T&...);
43 template <class Alloc, class... U>
44 tuple(allocator_arg_t, const Alloc& a, U&&...);
45 template <class Alloc>
46 tuple(allocator_arg_t, const Alloc& a, const tuple&);
47 template <class Alloc>
48 tuple(allocator_arg_t, const Alloc& a, tuple&&);
49 template <class Alloc, class... U>
50 tuple(allocator_arg_t, const Alloc& a, const tuple<U...>&);
51 template <class Alloc, class... U>
52 tuple(allocator_arg_t, const Alloc& a, tuple<U...>&&);
53 template <class Alloc, class U1, class U2>
54 tuple(allocator_arg_t, const Alloc& a, const pair<U1, U2>&);
55 template <class Alloc, class U1, class U2>
56 tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
57
58 tuple& operator=(const tuple&);
Howard Hinnanta5e01212011-05-27 19:08:1859 tuple&
60 operator=(tuple&&) noexcept(AND(is_nothrow_move_assignable<T>::value ...));
Howard Hinnantbc8d3f92010-05-11 19:42:1661 template <class... U>
62 tuple& operator=(const tuple<U...>&);
63 template <class... U>
64 tuple& operator=(tuple<U...>&&);
65 template <class U1, class U2>
66 tuple& operator=(const pair<U1, U2>&); // iff sizeof...(T) == 2
67 template <class U1, class U2>
68 tuple& operator=(pair<U1, U2>&&); //iffsizeof...(T) == 2
69
Howard Hinnanta5e01212011-05-27 19:08:1870 void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...));
Howard Hinnantbc8d3f92010-05-11 19:42:1671};
72
73const unspecified ignore;
74
Marshall Clowda0a0e82013-07-22 16:02:1975template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++14
Howard Hinnanta5e01212011-05-27 19:08:1876template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept;
77template <class... T> tuple<T&...> tie(T&...) noexcept;
Marshall Clowda0a0e82013-07-22 16:02:1978template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls); // constexpr in C++14
Howard Hinnant0e1493e2010-12-11 20:47:5079
Howard Hinnantbc8d3f92010-05-11 19:42:1680// 20.4.1.4, tuple helper classes:
81template <class T> class tuple_size; // undefined
82template <class... T> class tuple_size<tuple<T...>>;
83template <intsize_t I, class T> class tuple_element; // undefined
84template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
85
86// 20.4.1.5, element access:
Howard Hinnanta5e01212011-05-27 19:08:1887template <intsize_t I, class... T>
88 typename tuple_element<I, tuple<T...>>::type&
Marshall Clow8fc4f5a2013-07-17 18:25:3689 get(tuple<T...>&) noexcept; // constexpr in C++14
Howard Hinnanta5e01212011-05-27 19:08:1890template <intsize_t I, class... T>
91 typename tuple_element<I, tuple<T...>>::type const&
Marshall Clow8fc4f5a2013-07-17 18:25:3692 get(const tuple<T...>&) noexcept; // constexpr in C++14
Howard Hinnanta5e01212011-05-27 19:08:1893template <intsize_t I, class... T>
94 typename tuple_element<I, tuple<T...>>::type&&
Marshall Clow8fc4f5a2013-07-17 18:25:3695 get(tuple<T...>&&) noexcept; // constexpr in C++14
Howard Hinnantbc8d3f92010-05-11 19:42:1696
Marshall Clowe8029e52013-07-13 02:54:0597template <class T1, class... T>
98 constexpr T1& get(tuple<T...>&) noexcept; // C++14
99template <class T1, class... T>
100 constexpr T1 const& get(const tuple<T...>&) noexcept; // C++14
101template <class T1, class... T>
102 constexpr T1&& get(tuple<T...>&&) noexcept; // C++14
103
Howard Hinnantbc8d3f92010-05-11 19:42:16104// 20.4.1.6, relational operators:
Marshall Clowda0a0e82013-07-22 16:02:19105template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
106template<class... T, class... U> bool operator<(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
107template<class... T, class... U> bool operator!=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
108template<class... T, class... U> bool operator>(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
109template<class... T, class... U> bool operator<=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
110template<class... T, class... U> bool operator>=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
Howard Hinnantbc8d3f92010-05-11 19:42:16111
112template <class... Types, class Alloc>
113 struct uses_allocator<tuple<Types...>, Alloc>;
114
115template <class... Types>
Howard Hinnanta5e01212011-05-27 19:08:18116 void
117 swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(noexcept(x.swap(y)));
Howard Hinnantbc8d3f92010-05-11 19:42:16118
Howard Hinnantbc8d3f92010-05-11 19:42:16119} // std
120
121*/
122
123#include <__config>
124#include <__tuple>
125#include <cstddef>
Howard Hinnantbc8d3f92010-05-11 19:42:16126#include <type_traits>
Howard Hinnant6cc99fa2011-12-19 17:58:44127#include <__functional_base>
128#include <utility>
Howard Hinnantbc8d3f92010-05-11 19:42:16129
Howard Hinnant08e17472011-10-17 20:05:10130#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Howard Hinnantbc8d3f92010-05-11 19:42:16131#pragma GCC system_header
Howard Hinnant08e17472011-10-17 20:05:10132#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16133
134_LIBCPP_BEGIN_NAMESPACE_STD
135
Howard Hinnant6cc99fa2011-12-19 17:58:44136// allocator_arg_t
137
Howard Hinnant83eade62013-03-06 23:30:19138struct _LIBCPP_TYPE_VIS allocator_arg_t { };
Howard Hinnant6cc99fa2011-12-19 17:58:44139
Howard Hinnant46e94932012-07-07 20:56:04140#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
Howard Hinnant6cc99fa2011-12-19 17:58:44141extern const allocator_arg_t allocator_arg;
Howard Hinnant46e94932012-07-07 20:56:04142#else
143constexpr allocator_arg_t allocator_arg = allocator_arg_t();
144#endif
Howard Hinnant6cc99fa2011-12-19 17:58:44145
146// uses_allocator
147
148template <class _Tp>
149struct __has_allocator_type
150{
151private:
Howard Hinnant9c0df142012-10-30 19:06:59152 struct __two {char __lx; char __lxx;};
Howard Hinnant6cc99fa2011-12-19 17:58:44153 template <class _Up> static __two __test(...);
154 template <class _Up> static char __test(typename _Up::allocator_type* = 0);
155public:
156 static const bool value = sizeof(__test<_Tp>(0)) == 1;
157};
158
159template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
160struct __uses_allocator
161 : public integral_constant<bool,
162 is_convertible<_Alloc, typename _Tp::allocator_type>::value>
163{
164};
165
166template <class _Tp, class _Alloc>
167struct __uses_allocator<_Tp, _Alloc, false>
168 : public false_type
169{
170};
171
172template <class _Tp, class _Alloc>
Howard Hinnant83eade62013-03-06 23:30:19173struct _LIBCPP_TYPE_VIS uses_allocator
Howard Hinnant6cc99fa2011-12-19 17:58:44174 : public __uses_allocator<_Tp, _Alloc>
175{
176};
177
178#ifndef _LIBCPP_HAS_NO_VARIADICS
179
180// uses-allocator construction
181
182template <class _Tp, class _Alloc, class ..._Args>
183struct __uses_alloc_ctor_imp
184{
185 static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
186 static const bool __ic =
187 is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
188 static const int value = __ua ? 2 - __ic : 0;
189};
190
191template <class _Tp, class _Alloc, class ..._Args>
192struct __uses_alloc_ctor
193 : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
194 {};
195
196#endif // _LIBCPP_HAS_NO_VARIADICS
197
Howard Hinnantbc8d3f92010-05-11 19:42:16198#ifndef _LIBCPP_HAS_NO_VARIADICS
199
200// tuple_size
201
202template <class ..._Tp>
Howard Hinnant83eade62013-03-06 23:30:19203class _LIBCPP_TYPE_VIS tuple_size<tuple<_Tp...> >
Howard Hinnantbc8d3f92010-05-11 19:42:16204 : public integral_constant<size_t, sizeof...(_Tp)>
205{
206};
207
Howard Hinnantbc8d3f92010-05-11 19:42:16208// tuple_element
209
210template <size_t _Ip, class ..._Tp>
Howard Hinnant83eade62013-03-06 23:30:19211class _LIBCPP_TYPE_VIS tuple_element<_Ip, tuple<_Tp...> >
Howard Hinnantbc8d3f92010-05-11 19:42:16212{
213public:
Howard Hinnantf83417b2011-01-24 16:07:25214 typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
Howard Hinnantbc8d3f92010-05-11 19:42:16215};
216
Howard Hinnantbc8d3f92010-05-11 19:42:16217// __tuple_leaf
218
Howard Hinnantd4cf2152011-12-11 20:31:33219template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value
220#if __has_feature(is_final)
221 && !__is_final(_Hp)
222#endif
223 >
Howard Hinnantbc8d3f92010-05-11 19:42:16224class __tuple_leaf;
225
226template <size_t _Ip, class _Hp, bool _Ep>
Howard Hinnantee6ccd02010-09-23 18:58:28227inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16228void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
Howard Hinnanta5e01212011-05-27 19:08:18229 _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16230{
231 swap(__x.get(), __y.get());
232}
233
234template <size_t _Ip, class _Hp, bool>
235class __tuple_leaf
236{
237 _Hp value;
238
239 __tuple_leaf& operator=(const __tuple_leaf&);
240public:
Howard Hinnant4eebfc32012-07-06 20:50:27241 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
242 _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value()
Howard Hinnantbc8d3f92010-05-11 19:42:16243 {static_assert(!is_reference<_Hp>::value,
244 "Attempted to default construct a reference element in a tuple");}
245
246 template <class _Alloc>
247 _LIBCPP_INLINE_VISIBILITY
248 __tuple_leaf(integral_constant<int, 0>, const _Alloc&)
249 : value()
250 {static_assert(!is_reference<_Hp>::value,
251 "Attempted to default construct a reference element in a tuple");}
252
253 template <class _Alloc>
254 _LIBCPP_INLINE_VISIBILITY
255 __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
256 : value(allocator_arg_t(), __a)
257 {static_assert(!is_reference<_Hp>::value,
258 "Attempted to default construct a reference element in a tuple");}
259
260 template <class _Alloc>
261 _LIBCPP_INLINE_VISIBILITY
262 __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
263 : value(__a)
264 {static_assert(!is_reference<_Hp>::value,
265 "Attempted to default construct a reference element in a tuple");}
266
Howard Hinnante049cc52010-09-27 17:54:17267 template <class _Tp,
268 class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
Marshall Clowda0a0e82013-07-22 16:02:19269 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnant74f26f22012-07-06 21:53:48270 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
Howard Hinnant0949eed2011-06-30 21:18:19271 : value(_VSTD::forward<_Tp>(__t))
Howard Hinnante049cc52010-09-27 17:54:17272 {static_assert(!is_reference<_Hp>::value ||
Howard Hinnantec3773c2011-12-01 20:21:04273 (is_lvalue_reference<_Hp>::value &&
Howard Hinnantbc8d3f92010-05-11 19:42:16274 (is_lvalue_reference<_Tp>::value ||
275 is_same<typename remove_reference<_Tp>::type,
276 reference_wrapper<
277 typename remove_reference<_Hp>::type
278 >
Howard Hinnantec3773c2011-12-01 20:21:04279 >::value)) ||
Howard Hinnante049cc52010-09-27 17:54:17280 (is_rvalue_reference<_Hp>::value &&
281 !is_lvalue_reference<_Tp>::value),
Howard Hinnantbc8d3f92010-05-11 19:42:16282 "Attempted to construct a reference element in a tuple with an rvalue");}
283
284 template <class _Tp, class _Alloc>
285 _LIBCPP_INLINE_VISIBILITY
286 explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
Howard Hinnant0949eed2011-06-30 21:18:19287 : value(_VSTD::forward<_Tp>(__t))
Howard Hinnantbc8d3f92010-05-11 19:42:16288 {static_assert(!is_lvalue_reference<_Hp>::value ||
Howard Hinnantec3773c2011-12-01 20:21:04289 (is_lvalue_reference<_Hp>::value &&
Howard Hinnantbc8d3f92010-05-11 19:42:16290 (is_lvalue_reference<_Tp>::value ||
291 is_same<typename remove_reference<_Tp>::type,
292 reference_wrapper<
293 typename remove_reference<_Hp>::type
294 >
Howard Hinnantec3773c2011-12-01 20:21:04295 >::value)),
Howard Hinnantbc8d3f92010-05-11 19:42:16296 "Attempted to construct a reference element in a tuple with an rvalue");}
297
298 template <class _Tp, class _Alloc>
299 _LIBCPP_INLINE_VISIBILITY
300 explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
Howard Hinnant0949eed2011-06-30 21:18:19301 : value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t))
Howard Hinnantbc8d3f92010-05-11 19:42:16302 {static_assert(!is_lvalue_reference<_Hp>::value ||
Howard Hinnantec3773c2011-12-01 20:21:04303 (is_lvalue_reference<_Hp>::value &&
Howard Hinnantbc8d3f92010-05-11 19:42:16304 (is_lvalue_reference<_Tp>::value ||
305 is_same<typename remove_reference<_Tp>::type,
306 reference_wrapper<
307 typename remove_reference<_Hp>::type
308 >
Howard Hinnantec3773c2011-12-01 20:21:04309 >::value)),
Howard Hinnantbc8d3f92010-05-11 19:42:16310 "Attempted to construct a reference element in a tuple with an rvalue");}
311
312 template <class _Tp, class _Alloc>
313 _LIBCPP_INLINE_VISIBILITY
314 explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
Howard Hinnant0949eed2011-06-30 21:18:19315 : value(_VSTD::forward<_Tp>(__t), __a)
Howard Hinnantbc8d3f92010-05-11 19:42:16316 {static_assert(!is_lvalue_reference<_Hp>::value ||
Howard Hinnantec3773c2011-12-01 20:21:04317 (is_lvalue_reference<_Hp>::value &&
Howard Hinnantbc8d3f92010-05-11 19:42:16318 (is_lvalue_reference<_Tp>::value ||
319 is_same<typename remove_reference<_Tp>::type,
320 reference_wrapper<
321 typename remove_reference<_Hp>::type
322 >
Howard Hinnantec3773c2011-12-01 20:21:04323 >::value)),
Howard Hinnantbc8d3f92010-05-11 19:42:16324 "Attempted to construct a reference element in a tuple with an rvalue");}
325
Marshall Clowda0a0e82013-07-22 16:02:19326 _LIBCPP_INLINE_VISIBILITY
327 _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnant74f26f22012-07-06 21:53:48328 __tuple_leaf(const __tuple_leaf& __t) _NOEXCEPT_(is_nothrow_copy_constructible<_Hp>::value)
Howard Hinnante049cc52010-09-27 17:54:17329 : value(__t.get())
330 {static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");}
331
Marshall Clowda0a0e82013-07-22 16:02:19332 _LIBCPP_INLINE_VISIBILITY
333 _LIBCPP_CONSTEXPR_AFTER_CXX11
334 __tuple_leaf(__tuple_leaf&& __t) _NOEXCEPT_(is_nothrow_move_constructible<_Hp>::value)
335 : value(_VSTD::move(__t.get()))
336 {}
Howard Hinnantbc8d3f92010-05-11 19:42:16337
338 template <class _Tp>
339 _LIBCPP_INLINE_VISIBILITY
340 __tuple_leaf&
Howard Hinnant74f26f22012-07-06 21:53:48341 operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
Howard Hinnantbc8d3f92010-05-11 19:42:16342 {
Howard Hinnant0949eed2011-06-30 21:18:19343 value = _VSTD::forward<_Tp>(__t);
Howard Hinnantbc8d3f92010-05-11 19:42:16344 return *this;
345 }
346
347 _LIBCPP_INLINE_VISIBILITY
Howard Hinnanta5e01212011-05-27 19:08:18348 int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16349 {
Howard Hinnant0949eed2011-06-30 21:18:19350 _VSTD::swap(*this, __t);
Howard Hinnantbc8d3f92010-05-11 19:42:16351 return 0;
352 }
353
Marshall Clowda0a0e82013-07-22 16:02:19354 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return value;}
355 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return value;}
Howard Hinnantbc8d3f92010-05-11 19:42:16356};
357
358template <size_t _Ip, class _Hp>
359class __tuple_leaf<_Ip, _Hp, true>
360 : private _Hp
361{
362
363 __tuple_leaf& operator=(const __tuple_leaf&);
364public:
Howard Hinnant4eebfc32012-07-06 20:50:27365 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
366 _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
Howard Hinnantbc8d3f92010-05-11 19:42:16367
368 template <class _Alloc>
369 _LIBCPP_INLINE_VISIBILITY
370 __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {}
371
372 template <class _Alloc>
373 _LIBCPP_INLINE_VISIBILITY
374 __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
375 : _Hp(allocator_arg_t(), __a) {}
376
377 template <class _Alloc>
378 _LIBCPP_INLINE_VISIBILITY
379 __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
380 : _Hp(__a) {}
381
Howard Hinnante049cc52010-09-27 17:54:17382 template <class _Tp,
383 class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
Marshall Clowda0a0e82013-07-22 16:02:19384 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnant74f26f22012-07-06 21:53:48385 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
Howard Hinnant0949eed2011-06-30 21:18:19386 : _Hp(_VSTD::forward<_Tp>(__t)) {}
Howard Hinnantbc8d3f92010-05-11 19:42:16387
388 template <class _Tp, class _Alloc>
389 _LIBCPP_INLINE_VISIBILITY
390 explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
Howard Hinnant0949eed2011-06-30 21:18:19391 : _Hp(_VSTD::forward<_Tp>(__t)) {}
Howard Hinnantbc8d3f92010-05-11 19:42:16392
393 template <class _Tp, class _Alloc>
394 _LIBCPP_INLINE_VISIBILITY
395 explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
Howard Hinnant0949eed2011-06-30 21:18:19396 : _Hp(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {}
Howard Hinnantbc8d3f92010-05-11 19:42:16397
398 template <class _Tp, class _Alloc>
399 _LIBCPP_INLINE_VISIBILITY
400 explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
Howard Hinnant0949eed2011-06-30 21:18:19401 : _Hp(_VSTD::forward<_Tp>(__t), __a) {}
Howard Hinnantbc8d3f92010-05-11 19:42:16402
403 template <class _Tp>
404 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16405 __tuple_leaf&
Howard Hinnant74f26f22012-07-06 21:53:48406 operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
Howard Hinnantbc8d3f92010-05-11 19:42:16407 {
Howard Hinnant0949eed2011-06-30 21:18:19408 _Hp::operator=(_VSTD::forward<_Tp>(__t));
Howard Hinnantbc8d3f92010-05-11 19:42:16409 return *this;
410 }
411
Howard Hinnanta5e01212011-05-27 19:08:18412 _LIBCPP_INLINE_VISIBILITY
413 int
414 swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16415 {
Howard Hinnant0949eed2011-06-30 21:18:19416 _VSTD::swap(*this, __t);
Howard Hinnantbc8d3f92010-05-11 19:42:16417 return 0;
418 }
419
Marshall Clowda0a0e82013-07-22 16:02:19420 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);}
421 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);}
Howard Hinnantbc8d3f92010-05-11 19:42:16422};
423
Howard Hinnantee6ccd02010-09-23 18:58:28424template <class ..._Tp>
425_LIBCPP_INLINE_VISIBILITY
Howard Hinnant74f26f22012-07-06 21:53:48426void __swallow(_Tp&&...) _NOEXCEPT {}
Howard Hinnantbc8d3f92010-05-11 19:42:16427
Howard Hinnanta5e01212011-05-27 19:08:18428template <bool ...> struct __all;
429
430template <>
431struct __all<>
432{
433 static const bool value = true;
434};
435
Howard Hinnant99968442011-11-29 18:15:50436template <bool _B0, bool ... _Bp>
437struct __all<_B0, _Bp...>
Howard Hinnanta5e01212011-05-27 19:08:18438{
Howard Hinnant99968442011-11-29 18:15:50439 static const bool value = _B0 && __all<_Bp...>::value;
Howard Hinnanta5e01212011-05-27 19:08:18440};
441
Howard Hinnantbc8d3f92010-05-11 19:42:16442// __tuple_impl
443
444template<class _Indx, class ..._Tp> struct __tuple_impl;
445
446template<size_t ..._Indx, class ..._Tp>
447struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
448 : public __tuple_leaf<_Indx, _Tp>...
449{
Howard Hinnant5394c1e2012-07-06 20:39:45450 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant4eebfc32012-07-06 20:50:27451 _LIBCPP_CONSTEXPR __tuple_impl()
452 _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
Howard Hinnant5394c1e2012-07-06 20:39:45453
Howard Hinnantbc8d3f92010-05-11 19:42:16454 template <size_t ..._Uf, class ..._Tf,
455 size_t ..._Ul, class ..._Tl, class ..._Up>
Marshall Clowda0a0e82013-07-22 16:02:19456 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16457 explicit
458 __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
459 __tuple_indices<_Ul...>, __tuple_types<_Tl...>,
Howard Hinnant74f26f22012-07-06 21:53:48460 _Up&&... __u)
461 _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
462 __all<is_nothrow_default_constructible<_Tl>::value...>::value)) :
Howard Hinnant0949eed2011-06-30 21:18:19463 __tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))...,
Howard Hinnantbc8d3f92010-05-11 19:42:16464 __tuple_leaf<_Ul, _Tl>()...
465 {}
466
467 template <class _Alloc, size_t ..._Uf, class ..._Tf,
468 size_t ..._Ul, class ..._Tl, class ..._Up>
Howard Hinnantee6ccd02010-09-23 18:58:28469 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16470 explicit
471 __tuple_impl(allocator_arg_t, const _Alloc& __a,
472 __tuple_indices<_Uf...>, __tuple_types<_Tf...>,
473 __tuple_indices<_Ul...>, __tuple_types<_Tl...>,
474 _Up&&... __u) :
475 __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a,
Howard Hinnant0949eed2011-06-30 21:18:19476 _VSTD::forward<_Up>(__u))...,
Howard Hinnantbc8d3f92010-05-11 19:42:16477 __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)...
478 {}
479
480 template <class _Tuple,
481 class = typename enable_if
482 <
Howard Hinnant99324892013-04-14 00:01:13483 __tuple_constructible<_Tuple, tuple<_Tp...> >::value
Howard Hinnantbc8d3f92010-05-11 19:42:16484 >::type
485 >
Marshall Clowda0a0e82013-07-22 16:02:19486 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnant74f26f22012-07-06 21:53:48487 __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx,
488 typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
Howard Hinnant0949eed2011-06-30 21:18:19489 : __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename tuple_element<_Indx,
490 typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
Howard Hinnantbc8d3f92010-05-11 19:42:16491 {}
492
493 template <class _Alloc, class _Tuple,
494 class = typename enable_if
495 <
Howard Hinnantf83417b2011-01-24 16:07:25496 __tuple_convertible<_Tuple, tuple<_Tp...> >::value
Howard Hinnantbc8d3f92010-05-11 19:42:16497 >::type
498 >
Howard Hinnantee6ccd02010-09-23 18:58:28499 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16500 __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
501 : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx,
Howard Hinnant324bb032010-08-22 00:02:43502 typename __make_tuple_types<_Tuple>::type>::type>(), __a,
Howard Hinnant0949eed2011-06-30 21:18:19503 _VSTD::forward<typename tuple_element<_Indx,
504 typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
Howard Hinnantbc8d3f92010-05-11 19:42:16505 {}
506
507 template <class _Tuple>
Howard Hinnantee6ccd02010-09-23 18:58:28508 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16509 typename enable_if
510 <
Howard Hinnantf83417b2011-01-24 16:07:25511 __tuple_assignable<_Tuple, tuple<_Tp...> >::value,
Howard Hinnantbc8d3f92010-05-11 19:42:16512 __tuple_impl&
513 >::type
Howard Hinnant74f26f22012-07-06 21:53:48514 operator=(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_assignable<_Tp&, typename tuple_element<_Indx,
515 typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
Howard Hinnantbc8d3f92010-05-11 19:42:16516 {
Howard Hinnant0949eed2011-06-30 21:18:19517 __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<typename tuple_element<_Indx,
518 typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...);
Howard Hinnantbc8d3f92010-05-11 19:42:16519 return *this;
520 }
521
Howard Hinnant28484442012-02-15 20:13:52522 _LIBCPP_INLINE_VISIBILITY
523 __tuple_impl&
Howard Hinnant74f26f22012-07-06 21:53:48524 operator=(const __tuple_impl& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value))
Howard Hinnant28484442012-02-15 20:13:52525 {
526 __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
527 return *this;
528 }
529
Howard Hinnantee6ccd02010-09-23 18:58:28530 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16531 void swap(__tuple_impl& __t)
Howard Hinnanta5e01212011-05-27 19:08:18532 _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
Howard Hinnantbc8d3f92010-05-11 19:42:16533 {
534 __swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
535 }
536};
537
538template <class ..._Tp>
Howard Hinnant83eade62013-03-06 23:30:19539class _LIBCPP_TYPE_VIS tuple
Howard Hinnantbc8d3f92010-05-11 19:42:16540{
541 typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> base;
542
543 base base_;
544
Marshall Clow8fc4f5a2013-07-17 18:25:36545 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantec3773c2011-12-01 20:21:04546 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
Marshall Clow8fc4f5a2013-07-17 18:25:36547 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantec3773c2011-12-01 20:21:04548 const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
Marshall Clow8fc4f5a2013-07-17 18:25:36549 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantec3773c2011-12-01 20:21:04550 typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
Howard Hinnantbc8d3f92010-05-11 19:42:16551public:
552
Howard Hinnantee6ccd02010-09-23 18:58:28553 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant4eebfc32012-07-06 20:50:27554 _LIBCPP_CONSTEXPR tuple()
555 _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
Howard Hinnant5394c1e2012-07-06 20:39:45556
Marshall Clowda0a0e82013-07-22 16:02:19557 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnant74f26f22012-07-06 21:53:48558 explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
Howard Hinnantbc8d3f92010-05-11 19:42:16559 : base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
560 typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
561 typename __make_tuple_indices<0>::type(),
562 typename __make_tuple_types<tuple, 0>::type(),
563 __t...
564 ) {}
565
566 template <class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28567 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16568 tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
569 : base_(allocator_arg_t(), __a,
570 typename __make_tuple_indices<sizeof...(_Tp)>::type(),
571 typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
572 typename __make_tuple_indices<0>::type(),
573 typename __make_tuple_types<tuple, 0>::type(),
574 __t...
575 ) {}
576
577 template <class ..._Up,
Howard Hinnantdc1345f2012-04-01 23:10:42578 typename enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16579 <
580 sizeof...(_Up) <= sizeof...(_Tp) &&
581 __tuple_convertible
582 <
583 tuple<_Up...>,
584 typename __make_tuple_types<tuple,
585 sizeof...(_Up) < sizeof...(_Tp) ?
586 sizeof...(_Up) :
587 sizeof...(_Tp)>::type
Howard Hinnantdc1345f2012-04-01 23:10:42588 >::value,
589 bool
590 >::type = false
591 >
Marshall Clowda0a0e82013-07-22 16:02:19592 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantdc1345f2012-04-01 23:10:42593 tuple(_Up&&... __u)
Howard Hinnant74f26f22012-07-06 21:53:48594 _NOEXCEPT_((
595 is_nothrow_constructible<
596 typename __make_tuple_indices<sizeof...(_Up)>::type,
597 typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
598 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
599 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type,
600 _Up...
601 >::value
602 ))
Howard Hinnantdc1345f2012-04-01 23:10:42603 : base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
604 typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
605 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
606 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
607 _VSTD::forward<_Up>(__u)...) {}
608
609 template <class ..._Up,
610 typename enable_if
611 <
612 sizeof...(_Up) <= sizeof...(_Tp) &&
613 __tuple_constructible
614 <
615 tuple<_Up...>,
616 typename __make_tuple_types<tuple,
617 sizeof...(_Up) < sizeof...(_Tp) ?
618 sizeof...(_Up) :
619 sizeof...(_Tp)>::type
620 >::value &&
621 !__tuple_convertible
622 <
623 tuple<_Up...>,
624 typename __make_tuple_types<tuple,
625 sizeof...(_Up) < sizeof...(_Tp) ?
626 sizeof...(_Up) :
627 sizeof...(_Tp)>::type
628 >::value,
629 bool
630 >::type =false
Howard Hinnantbc8d3f92010-05-11 19:42:16631 >
Marshall Clowda0a0e82013-07-22 16:02:19632 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16633 explicit
634 tuple(_Up&&... __u)
Howard Hinnant74f26f22012-07-06 21:53:48635 _NOEXCEPT_((
636 is_nothrow_constructible<
637 typename __make_tuple_indices<sizeof...(_Up)>::type,
638 typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
639 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
640 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type,
641 _Up...
642 >::value
643 ))
Howard Hinnantbc8d3f92010-05-11 19:42:16644 : base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
645 typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
646 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
647 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
Howard Hinnant0949eed2011-06-30 21:18:19648 _VSTD::forward<_Up>(__u)...) {}
Howard Hinnantbc8d3f92010-05-11 19:42:16649
650 template <class _Alloc, class ..._Up,
651 class = typename enable_if
652 <
653 sizeof...(_Up) <= sizeof...(_Tp) &&
654 __tuple_convertible
655 <
656 tuple<_Up...>,
657 typename __make_tuple_types<tuple,
658 sizeof...(_Up) < sizeof...(_Tp) ?
659 sizeof...(_Up) :
660 sizeof...(_Tp)>::type
661 >::value
662 >::type
663 >
Howard Hinnantee6ccd02010-09-23 18:58:28664 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16665 tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
666 : base_(allocator_arg_t(), __a,
667 typename __make_tuple_indices<sizeof...(_Up)>::type(),
668 typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
669 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
670 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
Howard Hinnant0949eed2011-06-30 21:18:19671 _VSTD::forward<_Up>(__u)...) {}
Howard Hinnantbc8d3f92010-05-11 19:42:16672
673 template <class _Tuple,
Howard Hinnantdc1345f2012-04-01 23:10:42674 typename enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16675 <
Howard Hinnantdc1345f2012-04-01 23:10:42676 __tuple_convertible<_Tuple, tuple>::value,
677 bool
678 >::type = false
Howard Hinnantbc8d3f92010-05-11 19:42:16679 >
Marshall Clowda0a0e82013-07-22 16:02:19680 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnant74f26f22012-07-06 21:53:48681 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
Howard Hinnant0949eed2011-06-30 21:18:19682 : base_(_VSTD::forward<_Tuple>(__t)) {}
Howard Hinnantbc8d3f92010-05-11 19:42:16683
Howard Hinnantdc1345f2012-04-01 23:10:42684 template <class _Tuple,
685 typename enable_if
686 <
687 __tuple_constructible<_Tuple, tuple>::value &&
688 !__tuple_convertible<_Tuple, tuple>::value,
689 bool
690 >::type = false
691 >
Marshall Clowda0a0e82013-07-22 16:02:19692 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantdc1345f2012-04-01 23:10:42693 explicit
Howard Hinnant74f26f22012-07-06 21:53:48694 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
Howard Hinnantdc1345f2012-04-01 23:10:42695 : base_(_VSTD::forward<_Tuple>(__t)) {}
696
Howard Hinnantbc8d3f92010-05-11 19:42:16697 template <class _Alloc, class _Tuple,
698 class = typename enable_if
699 <
700 __tuple_convertible<_Tuple, tuple>::value
701 >::type
702 >
Howard Hinnantee6ccd02010-09-23 18:58:28703 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16704 tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
Howard Hinnant0949eed2011-06-30 21:18:19705 : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {}
Howard Hinnantbc8d3f92010-05-11 19:42:16706
707 template <class _Tuple,
708 class = typename enable_if
709 <
710 __tuple_assignable<_Tuple, tuple>::value
711 >::type
712 >
Howard Hinnantee6ccd02010-09-23 18:58:28713 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16714 tuple&
Howard Hinnant74f26f22012-07-06 21:53:48715 operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<base&, _Tuple>::value))
Howard Hinnantbc8d3f92010-05-11 19:42:16716 {
Howard Hinnant0949eed2011-06-30 21:18:19717 base_.operator=(_VSTD::forward<_Tuple>(__t));
Howard Hinnantbc8d3f92010-05-11 19:42:16718 return *this;
719 }
720
Howard Hinnantee6ccd02010-09-23 18:58:28721 _LIBCPP_INLINE_VISIBILITY
Howard Hinnanta5e01212011-05-27 19:08:18722 void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
723 {base_.swap(__t.base_);}
Howard Hinnantbc8d3f92010-05-11 19:42:16724};
725
726template <>
Howard Hinnant83eade62013-03-06 23:30:19727class _LIBCPP_TYPE_VIS tuple<>
Howard Hinnantbc8d3f92010-05-11 19:42:16728{
729public:
Howard Hinnantee6ccd02010-09-23 18:58:28730 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant4eebfc32012-07-06 20:50:27731 _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {}
Howard Hinnantbc8d3f92010-05-11 19:42:16732 template <class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28733 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant74f26f22012-07-06 21:53:48734 tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
Howard Hinnantbc8d3f92010-05-11 19:42:16735 template <class _Alloc>
Howard Hinnantee6ccd02010-09-23 18:58:28736 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant74f26f22012-07-06 21:53:48737 tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {}
Howard Hinnant99968442011-11-29 18:15:50738 template <class _Up>
Howard Hinnantee6ccd02010-09-23 18:58:28739 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant74f26f22012-07-06 21:53:48740 tuple(array<_Up, 0>) _NOEXCEPT {}
Howard Hinnant99968442011-11-29 18:15:50741 template <class _Alloc, class _Up>
Howard Hinnantee6ccd02010-09-23 18:58:28742 _LIBCPP_INLINE_VISIBILITY
Howard Hinnant74f26f22012-07-06 21:53:48743 tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {}
Howard Hinnantee6ccd02010-09-23 18:58:28744 _LIBCPP_INLINE_VISIBILITY
Howard Hinnanta5e01212011-05-27 19:08:18745 void swap(tuple&) _NOEXCEPT {}
Howard Hinnantbc8d3f92010-05-11 19:42:16746};
747
748template <class ..._Tp>
749inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantaabf2872011-06-01 19:59:32750typename enable_if
751<
752 __all<__is_swappable<_Tp>::value...>::value,
753 void
754>::type
Howard Hinnanta5e01212011-05-27 19:08:18755swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
756 _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
757 {__t.swap(__u);}
Howard Hinnantbc8d3f92010-05-11 19:42:16758
759// get
760
761template <size_t _Ip, class ..._Tp>
Marshall Clow8fc4f5a2013-07-17 18:25:36762inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantf83417b2011-01-24 16:07:25763typename tuple_element<_Ip, tuple<_Tp...> >::type&
Howard Hinnantec3773c2011-12-01 20:21:04764get(tuple<_Tp...>& __t) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16765{
Howard Hinnantf83417b2011-01-24 16:07:25766 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
Howard Hinnantbc8d3f92010-05-11 19:42:16767 return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get();
768}
769
770template <size_t _Ip, class ..._Tp>
Marshall Clow8fc4f5a2013-07-17 18:25:36771inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantf83417b2011-01-24 16:07:25772const typename tuple_element<_Ip, tuple<_Tp...> >::type&
Howard Hinnantec3773c2011-12-01 20:21:04773get(const tuple<_Tp...>& __t) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16774{
Howard Hinnantf83417b2011-01-24 16:07:25775 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
Howard Hinnantbc8d3f92010-05-11 19:42:16776 return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
777}
778
Howard Hinnantcd2254b2010-11-17 19:52:17779template <size_t _Ip, class ..._Tp>
Marshall Clow8fc4f5a2013-07-17 18:25:36780inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantf83417b2011-01-24 16:07:25781typename tuple_element<_Ip, tuple<_Tp...> >::type&&
Howard Hinnantec3773c2011-12-01 20:21:04782get(tuple<_Tp...>&& __t) _NOEXCEPT
Howard Hinnantcd2254b2010-11-17 19:52:17783{
Howard Hinnantf83417b2011-01-24 16:07:25784 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
Howard Hinnant56a85ca2011-01-25 16:31:30785 return static_cast<type&&>(
Douglas Gregor6c669942011-01-25 16:14:21786 static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
Howard Hinnantcd2254b2010-11-17 19:52:17787}
788
Marshall Clowe8029e52013-07-13 02:54:05789#if _LIBCPP_STD_VER > 11
790// get by type
791template <typename _T1, size_t _Idx, typename... _Args>
792struct __find_exactly_one_t_helper;
793
794// -- find exactly one
795template <typename _T1, size_t _Idx, typename... _Args>
796struct __find_exactly_one_t_checker {
797 static constexpr size_t value = _Idx;
798// Check the rest of the list to make sure there's only one
799 static_assert ( __find_exactly_one_t_helper<_T1, 0, _Args...>::value == -1, "type can only occur once in type list" );
800 };
801
802
803template <typename _T1, size_t _Idx>
804struct __find_exactly_one_t_helper <_T1, _Idx> {
805 static constexpr size_t value = -1;
806 };
807
808template <typename _T1, size_t _Idx, typename _Head, typename... _Args>
809struct __find_exactly_one_t_helper <_T1, _Idx, _Head, _Args...> {
810 static constexpr size_t value =
811 std::conditional<
812 std::is_same<_T1, _Head>::value,
813 __find_exactly_one_t_checker<_T1, _Idx,   _Args...>,
814 __find_exactly_one_t_helper <_T1, _Idx+1, _Args...>
815 >::type::value;
816 };
817
818template <typename _T1, typename... _Args>
819struct __find_exactly_one_t {
820 static constexpr size_t value = __find_exactly_one_t_helper<_T1, 0, _Args...>::value;
821 static_assert ( value != -1, "type not found in type list" );
822 };
823
824template <class _T1, class... _Args>
825inline _LIBCPP_INLINE_VISIBILITY
826constexpr _T1& get(tuple<_Args...>& __tup) noexcept
827{
828 return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
829}
830
831template <class _T1, class... _Args>
832inline _LIBCPP_INLINE_VISIBILITY
833constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept
834{
835 return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
836}
837
838template <class _T1, class... _Args>
839inline _LIBCPP_INLINE_VISIBILITY
840constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept
841{
Marshall Clow01a0e902013-07-15 20:46:11842 return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup));
Marshall Clowe8029e52013-07-13 02:54:05843}
844
845#endif
846
Howard Hinnantbc8d3f92010-05-11 19:42:16847// tie
848
849template <class ..._Tp>
Howard Hinnantee6ccd02010-09-23 18:58:28850inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16851tuple<_Tp&...>
Howard Hinnant74f26f22012-07-06 21:53:48852tie(_Tp&... __t) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16853{
854 return tuple<_Tp&...>(__t...);
855}
856
857template <class _Up>
858struct __ignore_t
859{
Howard Hinnantbc8d3f92010-05-11 19:42:16860 template <class _Tp>
Howard Hinnantee6ccd02010-09-23 18:58:28861 _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16862 const __ignore_t& operator=(_Tp&&) const {return *this;}
863};
864
865namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); }
866
Howard Hinnant83eade62013-03-06 23:30:19867template <class _Tp> class _LIBCPP_TYPE_VIS reference_wrapper;
Howard Hinnantbc8d3f92010-05-11 19:42:16868
869template <class _Tp>
870struct ___make_tuple_return
871{
872 typedef _Tp type;
873};
874
875template <class _Tp>
Howard Hinnantf83417b2011-01-24 16:07:25876struct ___make_tuple_return<reference_wrapper<_Tp> >
Howard Hinnantbc8d3f92010-05-11 19:42:16877{
878 typedef _Tp& type;
879};
880
881template <class _Tp>
882struct __make_tuple_return
883{
884 typedef typename ___make_tuple_return<typename decay<_Tp>::type>::type type;
885};
886
887template <class... _Tp>
Marshall Clowda0a0e82013-07-22 16:02:19888inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16889tuple<typename __make_tuple_return<_Tp>::type...>
890make_tuple(_Tp&&... __t)
891{
Howard Hinnant0949eed2011-06-30 21:18:19892 return tuple<typename __make_tuple_return<_Tp>::type...>(_VSTD::forward<_Tp>(__t)...);
Howard Hinnantbc8d3f92010-05-11 19:42:16893}
894
Howard Hinnant3c1ffba2010-08-19 18:59:38895template <class... _Tp>
Marshall Clowda0a0e82013-07-22 16:02:19896inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
897tuple<_Tp&&...>
898__forward_as_tuple(_Tp&&... __t) _NOEXCEPT
899{
900 return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
901}
902
903template <class... _Tp>
Howard Hinnantee6ccd02010-09-23 18:58:28904inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnant3c1ffba2010-08-19 18:59:38905tuple<_Tp&&...>
Howard Hinnant74f26f22012-07-06 21:53:48906forward_as_tuple(_Tp&&... __t) _NOEXCEPT
Howard Hinnant3c1ffba2010-08-19 18:59:38907{
Howard Hinnant0949eed2011-06-30 21:18:19908 return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
Howard Hinnant3c1ffba2010-08-19 18:59:38909}
910
Howard Hinnant99968442011-11-29 18:15:50911template <size_t _Ip>
Howard Hinnantbc8d3f92010-05-11 19:42:16912struct __tuple_equal
913{
914 template <class _Tp, class _Up>
Marshall Clowda0a0e82013-07-22 16:02:19915 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16916 bool operator()(const _Tp& __x, const _Up& __y)
917 {
Howard Hinnant99968442011-11-29 18:15:50918 return __tuple_equal<_Ip - 1>()(__x, __y) && get<_Ip-1>(__x) == get<_Ip-1>(__y);
Howard Hinnantbc8d3f92010-05-11 19:42:16919 }
920};
921
922template <>
923struct __tuple_equal<0>
924{
925 template <class _Tp, class _Up>
Marshall Clowda0a0e82013-07-22 16:02:19926 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16927 bool operator()(const _Tp&, const _Up&)
928 {
929 return true;
930 }
931};
932
933template <class ..._Tp, class ..._Up>
Marshall Clowda0a0e82013-07-22 16:02:19934inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16935bool
936operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
937{
938 return __tuple_equal<sizeof...(_Tp)>()(__x, __y);
939}
940
941template <class ..._Tp, class ..._Up>
Marshall Clowda0a0e82013-07-22 16:02:19942inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16943bool
944operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
945{
946 return !(__x == __y);
947}
948
Howard Hinnant99968442011-11-29 18:15:50949template <size_t _Ip>
Howard Hinnantbc8d3f92010-05-11 19:42:16950struct __tuple_less
951{
952 template <class _Tp, class _Up>
Marshall Clowda0a0e82013-07-22 16:02:19953 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16954 bool operator()(const _Tp& __x, const _Up& __y)
955 {
Howard Hinnant99968442011-11-29 18:15:50956 return __tuple_less<_Ip-1>()(__x, __y) ||
957 (!__tuple_less<_Ip-1>()(__y, __x) && get<_Ip-1>(__x) < get<_Ip-1>(__y));
Howard Hinnantbc8d3f92010-05-11 19:42:16958 }
959};
960
961template <>
962struct __tuple_less<0>
963{
964 template <class _Tp, class _Up>
Marshall Clowda0a0e82013-07-22 16:02:19965 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16966 bool operator()(const _Tp&, const _Up&)
967 {
968 return false;
969 }
970};
971
972template <class ..._Tp, class ..._Up>
Marshall Clowda0a0e82013-07-22 16:02:19973inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16974bool
975operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
976{
977 return __tuple_less<sizeof...(_Tp)>()(__x, __y);
978}
979
980template <class ..._Tp, class ..._Up>
Marshall Clowda0a0e82013-07-22 16:02:19981inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16982bool
983operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
984{
985 return __y < __x;
986}
987
988template <class ..._Tp, class ..._Up>
Marshall Clowda0a0e82013-07-22 16:02:19989inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16990bool
991operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
992{
993 return !(__x < __y);
994}
995
996template <class ..._Tp, class ..._Up>
Marshall Clowda0a0e82013-07-22 16:02:19997inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnantbc8d3f92010-05-11 19:42:16998bool
999operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
1000{
1001 return !(__y < __x);
1002}
1003
1004// tuple_cat
1005
Howard Hinnant0e1493e2010-12-11 20:47:501006template <class _Tp, class _Up> struct __tuple_cat_type;
1007
1008template <class ..._Ttypes, class ..._Utypes>
Howard Hinnantf83417b2011-01-24 16:07:251009struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
Howard Hinnantbc8d3f92010-05-11 19:42:161010{
Howard Hinnant0e1493e2010-12-11 20:47:501011 typedef tuple<_Ttypes..., _Utypes...> type;
1012};
1013
1014template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
1015struct __tuple_cat_return_1
1016{
1017};
1018
1019template <class ..._Types, class _Tuple0>
1020struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
1021{
1022 typedef typename __tuple_cat_type<tuple<_Types...>,
1023 typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type
1024 type;
1025};
1026
1027template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
1028struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
1029 : public __tuple_cat_return_1<
1030 typename __tuple_cat_type<
1031 tuple<_Types...>,
1032 typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type
1033 >::type,
1034 __tuple_like<typename remove_reference<_Tuple1>::type>::value,
1035 _Tuple1, _Tuples...>
1036{
1037};
1038
1039template <class ..._Tuples> struct __tuple_cat_return;
1040
1041template <class _Tuple0, class ..._Tuples>
1042struct __tuple_cat_return<_Tuple0, _Tuples...>
1043 : public __tuple_cat_return_1<tuple<>,
1044 __tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0,
1045 _Tuples...>
1046{
1047};
1048
1049template <>
1050struct __tuple_cat_return<>
1051{
1052 typedef tuple<> type;
1053};
1054
Marshall Clowda0a0e82013-07-22 16:02:191055inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnant0e1493e2010-12-11 20:47:501056tuple<>
1057tuple_cat()
1058{
1059 return tuple<>();
Howard Hinnantbc8d3f92010-05-11 19:42:161060}
1061
Howard Hinnant99968442011-11-29 18:15:501062template <class _Rp, class _Indices, class _Tuple0, class ..._Tuples>
Howard Hinnante48e3662010-12-12 23:04:371063struct __tuple_cat_return_ref_imp;
Howard Hinnantbc8d3f92010-05-11 19:42:161064
Howard Hinnante48e3662010-12-12 23:04:371065template <class ..._Types, size_t ..._I0, class _Tuple0>
1066struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
Howard Hinnantbc8d3f92010-05-11 19:42:161067{
Howard Hinnant0e1493e2010-12-11 20:47:501068 typedef typename remove_reference<_Tuple0>::type _T0;
Howard Hinnante48e3662010-12-12 23:04:371069 typedef tuple<_Types..., typename __apply_cv<_Tuple0,
1070 typename tuple_element<_I0, _T0>::type>::type&&...> type;
1071};
Howard Hinnantbc8d3f92010-05-11 19:42:161072
Howard Hinnante48e3662010-12-12 23:04:371073template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
1074struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
1075 _Tuple0, _Tuple1, _Tuples...>
1076 : public __tuple_cat_return_ref_imp<
1077 tuple<_Types..., typename __apply_cv<_Tuple0,
1078 typename tuple_element<_I0,
1079 typename remove_reference<_Tuple0>::type>::type>::type&&...>,
1080 typename __make_tuple_indices<tuple_size<typename
1081 remove_reference<_Tuple1>::type>::value>::type,
1082 _Tuple1, _Tuples...>
Howard Hinnantbc8d3f92010-05-11 19:42:161083{
Howard Hinnante48e3662010-12-12 23:04:371084};
1085
1086template <class _Tuple0, class ..._Tuples>
1087struct __tuple_cat_return_ref
1088 : public __tuple_cat_return_ref_imp<tuple<>,
1089 typename __make_tuple_indices<
1090 tuple_size<typename remove_reference<_Tuple0>::type>::value
1091 >::type, _Tuple0, _Tuples...>
1092{
1093};
1094
1095template <class _Types, class _I0, class _J0>
1096struct __tuple_cat;
1097
1098template <class ..._Types, size_t ..._I0, size_t ..._J0>
Howard Hinnantf83417b2011-01-24 16:07:251099struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> >
Howard Hinnante48e3662010-12-12 23:04:371100{
1101 template <class _Tuple0>
Marshall Clowda0a0e82013-07-22 16:02:191102 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnante48e3662010-12-12 23:04:371103 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
1104 operator()(tuple<_Types...> __t, _Tuple0&& __t0)
1105 {
Marshall Clowda0a0e82013-07-22 16:02:191106 return __forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))...,
Howard Hinnant0949eed2011-06-30 21:18:191107 get<_J0>(_VSTD::forward<_Tuple0>(__t0))...);
Howard Hinnante48e3662010-12-12 23:04:371108 }
1109
1110 template <class _Tuple0, class _Tuple1, class ..._Tuples>
Marshall Clowda0a0e82013-07-22 16:02:191111 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnante48e3662010-12-12 23:04:371112 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
1113 operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
1114 {
1115 typedef typename remove_reference<_Tuple0>::type _T0;
1116 typedef typename remove_reference<_Tuple1>::type _T1;
1117 return __tuple_cat<
1118 tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
1119 typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
1120 typename __make_tuple_indices<tuple_size<_T1>::value>::type>()
Marshall Clowda0a0e82013-07-22 16:02:191121 (__forward_as_tuple(
Howard Hinnant0949eed2011-06-30 21:18:191122 _VSTD::forward<_Types>(get<_I0>(__t))...,
1123 get<_J0>(_VSTD::forward<_Tuple0>(__t0))...
Howard Hinnante48e3662010-12-12 23:04:371124 ),
Howard Hinnant0949eed2011-06-30 21:18:191125 _VSTD::forward<_Tuple1>(__t1),
1126 _VSTD::forward<_Tuples>(__tpls)...);
Howard Hinnante48e3662010-12-12 23:04:371127 }
1128};
1129
1130template <class _Tuple0, class... _Tuples>
Marshall Clowda0a0e82013-07-22 16:02:191131inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
Howard Hinnante48e3662010-12-12 23:04:371132typename __tuple_cat_return<_Tuple0, _Tuples...>::type
1133tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
1134{
1135 typedef typename remove_reference<_Tuple0>::type _T0;
1136 return __tuple_cat<tuple<>, __tuple_indices<>,
1137 typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
Howard Hinnant0949eed2011-06-30 21:18:191138 (tuple<>(), _VSTD::forward<_Tuple0>(__t0),
1139 _VSTD::forward<_Tuples>(__tpls)...);
Howard Hinnantbc8d3f92010-05-11 19:42:161140}
1141
1142template <class ..._Tp, class _Alloc>
Howard Hinnant83eade62013-03-06 23:30:191143struct _LIBCPP_TYPE_VIS uses_allocator<tuple<_Tp...>, _Alloc>
Howard Hinnantbc8d3f92010-05-11 19:42:161144 : true_type {};
1145
Howard Hinnantbc8d3f92010-05-11 19:42:161146template <class _T1, class _T2>
1147template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2>
1148inline _LIBCPP_INLINE_VISIBILITY
1149pair<_T1, _T2>::pair(piecewise_construct_t,
1150 tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
1151 __tuple_indices<_I1...>, __tuple_indices<_I2...>)
Howard Hinnant0949eed2011-06-30 21:18:191152 : first(_VSTD::forward<_Args1>(get<_I1>( __first_args))...),
1153 second(_VSTD::forward<_Args2>(get<_I2>(__second_args))...)
Howard Hinnantbc8d3f92010-05-11 19:42:161154{
1155}
1156
Howard Hinnant324bb032010-08-22 00:02:431157#endif // _LIBCPP_HAS_NO_VARIADICS
Howard Hinnantbc8d3f92010-05-11 19:42:161158
1159_LIBCPP_END_NAMESPACE_STD
1160
1161#endif // _LIBCPP_TUPLE