1// -*- C++ -*- 2//===--------------------------- tuple ------------------------------------===// 3// 4// The LLVM Compiler Infrastructure 5// 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(); 24 explicit tuple(const T&...); // constexpr in C++14 25 template <class... U> 26 explicit tuple(U&&...); // constexpr in C++14 27 tuple(const tuple&) = default; 28 tuple(tuple&&) = default; 29 template <class... U> 30 tuple(const tuple<U...>&); // constexpr in C++14 31 template <class... U> 32 tuple(tuple<U...>&&); // constexpr in C++14 33 template <class U1, class U2> 34 tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14 35 template <class U1, class U2> 36 tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++14 37 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&); 59 tuple& 60 operator=(tuple&&) noexcept(AND(is_nothrow_move_assignable<T>::value ...)); 61 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 70 void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...)); 71}; 72 73const unspecified ignore; 74 75template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++14 76template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept; // constexpr in C++14 77template <class... T> tuple<T&...> tie(T&...) noexcept; // constexpr in C++14 78template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls); // constexpr in C++14 79 80// 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...>>; 85template <size_t _Ip, class ..._Tp> 86 using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; // C++14 87 88// 20.4.1.5, element access: 89template <intsize_t I, class... T> 90 typename tuple_element<I, tuple<T...>>::type& 91 get(tuple<T...>&) noexcept; // constexpr in C++14 92template <intsize_t I, class... T> 93 typename const tuple_element<I, tuple<T...>>::type & 94 get(const tuple<T...>&) noexcept; // constexpr in C++14 95template <intsize_t I, class... T> 96 typename tuple_element<I, tuple<T...>>::type&& 97 get(tuple<T...>&&) noexcept; // constexpr in C++14 98 99template <class T1, class... T> 100 constexpr T1& get(tuple<T...>&) noexcept; // C++14 101template <class T1, class... T> 102 constexpr T1 const& get(const tuple<T...>&) noexcept; // C++14 103template <class T1, class... T> 104 constexpr T1&& get(tuple<T...>&&) noexcept; // C++14 105 106// 20.4.1.6, relational operators: 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 111template<class... T, class... U> bool operator<=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14 112template<class... T, class... U> bool operator>=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14 113 114template <class... Types, class Alloc> 115 struct uses_allocator<tuple<Types...>, Alloc>; 116 117template <class... Types> 118 void 119 swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(noexcept(x.swap(y))); 120 121} // std 122 123*/ 124 125#include <__config> 126#include <__tuple> 127#include <cstddef> 128#include <type_traits> 129#include <__functional_base> 130#include <utility> 131 132#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 133#pragma GCC system_header 134#endif 135 136_LIBCPP_BEGIN_NAMESPACE_STD 137 138#ifndef _LIBCPP_HAS_NO_VARIADICS 139 140// tuple_size 141 142template <class ..._Tp> 143class _LIBCPP_TYPE_VIS_ONLY tuple_size<tuple<_Tp...> > 144 : public integral_constant<size_t, sizeof...(_Tp)> 145{ 146}; 147 148// tuple_element 149 150template <size_t _Ip, class ..._Tp> 151class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, tuple<_Tp...> > 152{ 153public: 154 typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type; 155}; 156 157#if _LIBCPP_STD_VER > 11 158template <size_t _Ip, class ..._Tp> 159using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; 160#endif 161 162// __tuple_leaf 163 164template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value 165#if __has_feature(is_final) 166 && !__is_final(_Hp) 167#endif 168 > 169class __tuple_leaf; 170 171template <size_t _Ip, class _Hp, bool _Ep> 172inline _LIBCPP_INLINE_VISIBILITY 173void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) 174 _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value) 175{ 176 swap(__x.get(), __y.get()); 177} 178 179template <size_t _Ip, class _Hp, bool> 180class __tuple_leaf 181{ 182 _Hp value; 183 184 __tuple_leaf& operator=(const __tuple_leaf&); 185public: 186 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() 187 _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value() 188 {static_assert(!is_reference<_Hp>::value, 189 "Attempted to default construct a reference element in a tuple");} 190 191 template <class _Alloc> 192 _LIBCPP_INLINE_VISIBILITY 193 __tuple_leaf(integral_constant<int, 0>, const _Alloc&) 194 : value() 195 {static_assert(!is_reference<_Hp>::value, 196 "Attempted to default construct a reference element in a tuple");} 197 198 template <class _Alloc> 199 _LIBCPP_INLINE_VISIBILITY 200 __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a) 201 : value(allocator_arg_t(), __a) 202 {static_assert(!is_reference<_Hp>::value, 203 "Attempted to default construct a reference element in a tuple");} 204 205 template <class _Alloc> 206 _LIBCPP_INLINE_VISIBILITY 207 __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) 208 : value(__a) 209 {static_assert(!is_reference<_Hp>::value, 210 "Attempted to default construct a reference element in a tuple");} 211 212 template <class _Tp, 213 class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type> 214 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 215 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) 216 : value(_VSTD::forward<_Tp>(__t)) 217 {static_assert(!is_reference<_Hp>::value || 218 (is_lvalue_reference<_Hp>::value && 219 (is_lvalue_reference<_Tp>::value || 220 is_same<typename remove_reference<_Tp>::type, 221 reference_wrapper< 222 typename remove_reference<_Hp>::type 223 > 224 >::value)) || 225 (is_rvalue_reference<_Hp>::value && 226 !is_lvalue_reference<_Tp>::value), 227 "Attempted to construct a reference element in a tuple with an rvalue");} 228 229 template <class _Tp, class _Alloc> 230 _LIBCPP_INLINE_VISIBILITY 231 explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t) 232 : value(_VSTD::forward<_Tp>(__t)) 233 {static_assert(!is_lvalue_reference<_Hp>::value || 234 (is_lvalue_reference<_Hp>::value && 235 (is_lvalue_reference<_Tp>::value || 236 is_same<typename remove_reference<_Tp>::type, 237 reference_wrapper< 238 typename remove_reference<_Hp>::type 239 > 240 >::value)), 241 "Attempted to construct a reference element in a tuple with an rvalue");} 242 243 template <class _Tp, class _Alloc> 244 _LIBCPP_INLINE_VISIBILITY 245 explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t) 246 : value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) 247 {static_assert(!is_lvalue_reference<_Hp>::value || 248 (is_lvalue_reference<_Hp>::value && 249 (is_lvalue_reference<_Tp>::value || 250 is_same<typename remove_reference<_Tp>::type, 251 reference_wrapper< 252 typename remove_reference<_Hp>::type 253 > 254 >::value)), 255 "Attempted to construct a reference element in a tuple with an rvalue");} 256 257 template <class _Tp, class _Alloc> 258 _LIBCPP_INLINE_VISIBILITY 259 explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t) 260 : value(_VSTD::forward<_Tp>(__t), __a) 261 {static_assert(!is_lvalue_reference<_Hp>::value || 262 (is_lvalue_reference<_Hp>::value && 263 (is_lvalue_reference<_Tp>::value || 264 is_same<typename remove_reference<_Tp>::type, 265 reference_wrapper< 266 typename remove_reference<_Hp>::type 267 > 268 >::value)), 269 "Attempted to construct a reference element in a tuple with an rvalue");} 270 271 _LIBCPP_INLINE_VISIBILITY 272 _LIBCPP_CONSTEXPR_AFTER_CXX11 273 __tuple_leaf(const __tuple_leaf& __t) _NOEXCEPT_(is_nothrow_copy_constructible<_Hp>::value) 274 : value(__t.get()) 275 {static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");} 276 277 _LIBCPP_INLINE_VISIBILITY 278 _LIBCPP_CONSTEXPR_AFTER_CXX11 279 __tuple_leaf(__tuple_leaf&& __t) _NOEXCEPT_(is_nothrow_move_constructible<_Hp>::value) 280 : value(_VSTD::forward<_Hp>(__t.get())) 281 {} 282 283 template <class _Tp> 284 _LIBCPP_INLINE_VISIBILITY 285 __tuple_leaf& 286 operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) 287 { 288 value = _VSTD::forward<_Tp>(__t); 289 return *this; 290 } 291 292 _LIBCPP_INLINE_VISIBILITY 293 int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) 294 { 295 _VSTD::swap(*this, __t); 296 return 0; 297 } 298 299 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return value;} 300 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return value;} 301}; 302 303template <size_t _Ip, class _Hp> 304class __tuple_leaf<_Ip, _Hp, true> 305 : private _Hp 306{ 307 308 __tuple_leaf& operator=(const __tuple_leaf&); 309public: 310 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() 311 _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {} 312 313 template <class _Alloc> 314 _LIBCPP_INLINE_VISIBILITY 315 __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {} 316 317 template <class _Alloc> 318 _LIBCPP_INLINE_VISIBILITY 319 __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a) 320 : _Hp(allocator_arg_t(), __a) {} 321 322 template <class _Alloc> 323 _LIBCPP_INLINE_VISIBILITY 324 __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) 325 : _Hp(__a) {} 326 327 template <class _Tp, 328 class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type> 329 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 330 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) 331 : _Hp(_VSTD::forward<_Tp>(__t)) {} 332 333 template <class _Tp, class _Alloc> 334 _LIBCPP_INLINE_VISIBILITY 335 explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t) 336 : _Hp(_VSTD::forward<_Tp>(__t)) {} 337 338 template <class _Tp, class _Alloc> 339 _LIBCPP_INLINE_VISIBILITY 340 explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t) 341 : _Hp(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {} 342 343 template <class _Tp, class _Alloc> 344 _LIBCPP_INLINE_VISIBILITY 345 explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t) 346 : _Hp(_VSTD::forward<_Tp>(__t), __a) {} 347 348 template <class _Tp> 349 _LIBCPP_INLINE_VISIBILITY 350 __tuple_leaf& 351 operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) 352 { 353 _Hp::operator=(_VSTD::forward<_Tp>(__t)); 354 return *this; 355 } 356 357 _LIBCPP_INLINE_VISIBILITY 358 int 359 swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) 360 { 361 _VSTD::swap(*this, __t); 362 return 0; 363 } 364 365 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);} 366 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);} 367}; 368 369template <class ..._Tp> 370_LIBCPP_INLINE_VISIBILITY 371void __swallow(_Tp&&...) _NOEXCEPT {} 372 373template <bool ...> struct __all; 374 375template <> 376struct __all<> 377{ 378 static const bool value = true; 379}; 380 381template <bool _B0, bool ... _Bp> 382struct __all<_B0, _Bp...> 383{ 384 static const bool value = _B0 && __all<_Bp...>::value; 385}; 386 387// __tuple_impl 388 389template<class _Indx, class ..._Tp> struct __tuple_impl; 390 391template<size_t ..._Indx, class ..._Tp> 392struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...> 393 : public __tuple_leaf<_Indx, _Tp>... 394{ 395 _LIBCPP_INLINE_VISIBILITY 396 _LIBCPP_CONSTEXPR __tuple_impl() 397 _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} 398 399 template <size_t ..._Uf, class ..._Tf, 400 size_t ..._Ul, class ..._Tl, class ..._Up> 401 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 402 explicit 403 __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>, 404 __tuple_indices<_Ul...>, __tuple_types<_Tl...>, 405 _Up&&... __u) 406 _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value && 407 __all<is_nothrow_default_constructible<_Tl>::value...>::value)) : 408 __tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))..., 409 __tuple_leaf<_Ul, _Tl>()... 410 {} 411 412 template <class _Alloc, size_t ..._Uf, class ..._Tf, 413 size_t ..._Ul, class ..._Tl, class ..._Up> 414 _LIBCPP_INLINE_VISIBILITY 415 explicit 416 __tuple_impl(allocator_arg_t, const _Alloc& __a, 417 __tuple_indices<_Uf...>, __tuple_types<_Tf...>, 418 __tuple_indices<_Ul...>, __tuple_types<_Tl...>, 419 _Up&&... __u) : 420 __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, 421 _VSTD::forward<_Up>(__u))..., 422 __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... 423 {} 424 425 template <class _Tuple, 426 class = typename enable_if 427 < 428 __tuple_constructible<_Tuple, tuple<_Tp...> >::value 429 >::type 430 > 431 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 432 __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx, 433 typename __make_tuple_types<_Tuple>::type>::type>::value...>::value)) 434 : __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename tuple_element<_Indx, 435 typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))... 436 {} 437 438 template <class _Alloc, class _Tuple, 439 class = typename enable_if 440 < 441 __tuple_convertible<_Tuple, tuple<_Tp...> >::value 442 >::type 443 > 444 _LIBCPP_INLINE_VISIBILITY 445 __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) 446 : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx, 447 typename __make_tuple_types<_Tuple>::type>::type>(), __a, 448 _VSTD::forward<typename tuple_element<_Indx, 449 typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))... 450 {} 451 452 template <class _Tuple> 453 _LIBCPP_INLINE_VISIBILITY 454 typename enable_if 455 < 456 __tuple_assignable<_Tuple, tuple<_Tp...> >::value, 457 __tuple_impl& 458 >::type 459 operator=(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_assignable<_Tp&, typename tuple_element<_Indx, 460 typename __make_tuple_types<_Tuple>::type>::type>::value...>::value)) 461 { 462 __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<typename tuple_element<_Indx, 463 typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...); 464 return *this; 465 } 466 467 __tuple_impl(const __tuple_impl&) = default; 468 __tuple_impl(__tuple_impl&&) = default; 469 470 _LIBCPP_INLINE_VISIBILITY 471 __tuple_impl& 472 operator=(const __tuple_impl& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value)) 473 { 474 __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...); 475 return *this; 476 } 477 478 _LIBCPP_INLINE_VISIBILITY 479 __tuple_impl& 480 operator=(__tuple_impl&& __t) _NOEXCEPT_((__all<is_nothrow_move_assignable<_Tp>::value...>::value)) 481 { 482 __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<_Tp>(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t).get()))...); 483 return *this; 484 } 485 486 _LIBCPP_INLINE_VISIBILITY 487 void swap(__tuple_impl& __t) 488 _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) 489 { 490 __swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...); 491 } 492}; 493 494template <class ..._Tp> 495class _LIBCPP_TYPE_VIS_ONLY tuple 496{ 497 typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> base; 498 499 base base_; 500 501 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11 502 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT; 503 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11 504 const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT; 505 template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11 506 typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT; 507public: 508 509 _LIBCPP_INLINE_VISIBILITY 510 _LIBCPP_CONSTEXPR tuple() 511 _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} 512 513 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 514 explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value)) 515 : base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), 516 typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(), 517 typename __make_tuple_indices<0>::type(), 518 typename __make_tuple_types<tuple, 0>::type(), 519 __t... 520 ) {} 521 522 template <class _Alloc> 523 _LIBCPP_INLINE_VISIBILITY 524 tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) 525 : base_(allocator_arg_t(), __a, 526 typename __make_tuple_indices<sizeof...(_Tp)>::type(), 527 typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(), 528 typename __make_tuple_indices<0>::type(), 529 typename __make_tuple_types<tuple, 0>::type(), 530 __t... 531 ) {} 532 533 template <class ..._Up, 534 typename enable_if 535 < 536 sizeof...(_Up) <= sizeof...(_Tp) && 537 __tuple_convertible 538 < 539 tuple<_Up...>, 540 typename __make_tuple_types<tuple, 541 sizeof...(_Up) < sizeof...(_Tp) ? 542 sizeof...(_Up) : 543 sizeof...(_Tp)>::type 544 >::value, 545 bool 546 >::type = false 547 > 548 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 549 tuple(_Up&&... __u) 550 _NOEXCEPT_(( 551 is_nothrow_constructible< 552 typename __make_tuple_indices<sizeof...(_Up)>::type, 553 typename __make_tuple_types<tuple, sizeof...(_Up)>::type, 554 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type, 555 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type, 556 _Up... 557 >::value 558 )) 559 : base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), 560 typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), 561 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), 562 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(), 563 _VSTD::forward<_Up>(__u)...) {} 564 565 template <class ..._Up, 566 typename enable_if 567 < 568 sizeof...(_Up) <= sizeof...(_Tp) && 569 __tuple_constructible 570 < 571 tuple<_Up...>, 572 typename __make_tuple_types<tuple, 573 sizeof...(_Up) < sizeof...(_Tp) ? 574 sizeof...(_Up) : 575 sizeof...(_Tp)>::type 576 >::value && 577 !__tuple_convertible 578 < 579 tuple<_Up...>, 580 typename __make_tuple_types<tuple, 581 sizeof...(_Up) < sizeof...(_Tp) ? 582 sizeof...(_Up) : 583 sizeof...(_Tp)>::type 584 >::value, 585 bool 586 >::type =false 587 > 588 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 589 explicit 590 tuple(_Up&&... __u) 591 _NOEXCEPT_(( 592 is_nothrow_constructible< 593 typename __make_tuple_indices<sizeof...(_Up)>::type, 594 typename __make_tuple_types<tuple, sizeof...(_Up)>::type, 595 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type, 596 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type, 597 _Up... 598 >::value 599 )) 600 : base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), 601 typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), 602 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), 603 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(), 604 _VSTD::forward<_Up>(__u)...) {} 605 606 template <class _Alloc, class ..._Up, 607 class = typename enable_if 608 < 609 sizeof...(_Up) <= sizeof...(_Tp) && 610 __tuple_convertible 611 < 612 tuple<_Up...>, 613 typename __make_tuple_types<tuple, 614 sizeof...(_Up) < sizeof...(_Tp) ? 615 sizeof...(_Up) : 616 sizeof...(_Tp)>::type 617 >::value 618 >::type 619 > 620 _LIBCPP_INLINE_VISIBILITY 621 tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) 622 : base_(allocator_arg_t(), __a, 623 typename __make_tuple_indices<sizeof...(_Up)>::type(), 624 typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), 625 typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), 626 typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(), 627 _VSTD::forward<_Up>(__u)...) {} 628 629 template <class _Tuple, 630 typename enable_if 631 < 632 __tuple_convertible<_Tuple, tuple>::value, 633 bool 634 >::type = false 635 > 636 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 637 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value)) 638 : base_(_VSTD::forward<_Tuple>(__t)) {} 639 640 template <class _Tuple, 641 typename enable_if 642 < 643 __tuple_constructible<_Tuple, tuple>::value && 644 !__tuple_convertible<_Tuple, tuple>::value, 645 bool 646 >::type = false 647 > 648 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 649 explicit 650 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value)) 651 : base_(_VSTD::forward<_Tuple>(__t)) {} 652 653 template <class _Alloc, class _Tuple, 654 class = typename enable_if 655 < 656 __tuple_convertible<_Tuple, tuple>::value 657 >::type 658 > 659 _LIBCPP_INLINE_VISIBILITY 660 tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) 661 : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} 662 663 template <class _Tuple, 664 class = typename enable_if 665 < 666 __tuple_assignable<_Tuple, tuple>::value 667 >::type 668 > 669 _LIBCPP_INLINE_VISIBILITY 670 tuple& 671 operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<base&, _Tuple>::value)) 672 { 673 base_.operator=(_VSTD::forward<_Tuple>(__t)); 674 return *this; 675 } 676 677 _LIBCPP_INLINE_VISIBILITY 678 void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) 679 {base_.swap(__t.base_);} 680}; 681 682template <> 683class _LIBCPP_TYPE_VIS_ONLY tuple<> 684{ 685public: 686 _LIBCPP_INLINE_VISIBILITY 687 _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {} 688 template <class _Alloc> 689 _LIBCPP_INLINE_VISIBILITY 690 tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {} 691 template <class _Alloc> 692 _LIBCPP_INLINE_VISIBILITY 693 tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {} 694 template <class _Up> 695 _LIBCPP_INLINE_VISIBILITY 696 tuple(array<_Up, 0>) _NOEXCEPT {} 697 template <class _Alloc, class _Up> 698 _LIBCPP_INLINE_VISIBILITY 699 tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {} 700 _LIBCPP_INLINE_VISIBILITY 701 void swap(tuple&) _NOEXCEPT {} 702}; 703 704template <class ..._Tp> 705inline _LIBCPP_INLINE_VISIBILITY 706typename enable_if 707< 708 __all<__is_swappable<_Tp>::value...>::value, 709 void 710>::type 711swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) 712 _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) 713 {__t.swap(__u);} 714 715// get 716 717template <size_t _Ip, class ..._Tp> 718inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 719typename tuple_element<_Ip, tuple<_Tp...> >::type& 720get(tuple<_Tp...>& __t) _NOEXCEPT 721{ 722 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; 723 return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get(); 724} 725 726template <size_t _Ip, class ..._Tp> 727inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 728const typename tuple_element<_Ip, tuple<_Tp...> >::type& 729get(const tuple<_Tp...>& __t) _NOEXCEPT 730{ 731 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; 732 return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get(); 733} 734 735template <size_t _Ip, class ..._Tp> 736inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 737typename tuple_element<_Ip, tuple<_Tp...> >::type&& 738get(tuple<_Tp...>&& __t) _NOEXCEPT 739{ 740 typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; 741 return static_cast<type&&>( 742 static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get()); 743} 744 745#if _LIBCPP_STD_VER > 11 746// get by type 747template <typename _T1, size_t _Idx, typename... _Args> 748struct __find_exactly_one_t_helper; 749 750// -- find exactly one 751template <typename _T1, size_t _Idx, typename... _Args> 752struct __find_exactly_one_t_checker { 753 static constexpr size_t value = _Idx; 754// Check the rest of the list to make sure there's only one 755 static_assert ( __find_exactly_one_t_helper<_T1, 0, _Args...>::value == -1, "type can only occur once in type list" ); 756 }; 757 758 759template <typename _T1, size_t _Idx> 760struct __find_exactly_one_t_helper <_T1, _Idx> { 761 static constexpr size_t value = -1; 762 }; 763 764template <typename _T1, size_t _Idx, typename _Head, typename... _Args> 765struct __find_exactly_one_t_helper <_T1, _Idx, _Head, _Args...> { 766 static constexpr size_t value = 767 std::conditional< 768 std::is_same<_T1, _Head>::value, 769 __find_exactly_one_t_checker<_T1, _Idx, _Args...>, 770 __find_exactly_one_t_helper <_T1, _Idx+1, _Args...> 771 >::type::value; 772 }; 773 774template <typename _T1, typename... _Args> 775struct __find_exactly_one_t { 776 static constexpr size_t value = __find_exactly_one_t_helper<_T1, 0, _Args...>::value; 777 static_assert ( value != -1, "type not found in type list" ); 778 }; 779 780template <class _T1, class... _Args> 781inline _LIBCPP_INLINE_VISIBILITY 782constexpr _T1& get(tuple<_Args...>& __tup) noexcept 783{ 784 return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup); 785} 786 787template <class _T1, class... _Args> 788inline _LIBCPP_INLINE_VISIBILITY 789constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept 790{ 791 return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup); 792} 793 794template <class _T1, class... _Args> 795inline _LIBCPP_INLINE_VISIBILITY 796constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept 797{ 798 return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup)); 799} 800 801#endif 802 803// tie 804 805template <class ..._Tp> 806inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 807tuple<_Tp&...> 808tie(_Tp&... __t) _NOEXCEPT 809{ 810 return tuple<_Tp&...>(__t...); 811} 812 813template <class _Up> 814struct __ignore_t 815{ 816 template <class _Tp> 817 _LIBCPP_INLINE_VISIBILITY 818 const __ignore_t& operator=(_Tp&&) const {return *this;} 819}; 820 821namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); } 822 823template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY reference_wrapper; 824 825template <class _Tp> 826struct __make_tuple_return_impl 827{ 828 typedef _Tp type; 829}; 830 831template <class _Tp> 832struct __make_tuple_return_impl<reference_wrapper<_Tp> > 833{ 834 typedef _Tp& type; 835}; 836 837template <class _Tp> 838struct __make_tuple_return 839{ 840 typedef typename __make_tuple_return_impl<typename decay<_Tp>::type>::type type; 841}; 842 843template <class... _Tp> 844inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 845tuple<typename __make_tuple_return<_Tp>::type...> 846make_tuple(_Tp&&... __t) 847{ 848 return tuple<typename __make_tuple_return<_Tp>::type...>(_VSTD::forward<_Tp>(__t)...); 849} 850 851template <class... _Tp> 852inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 853tuple<_Tp&&...> 854forward_as_tuple(_Tp&&... __t) _NOEXCEPT 855{ 856 return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...); 857} 858 859template <size_t _Ip> 860struct __tuple_equal 861{ 862 template <class _Tp, class _Up> 863 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 864 bool operator()(const _Tp& __x, const _Up& __y) 865 { 866 return __tuple_equal<_Ip - 1>()(__x, __y) && get<_Ip-1>(__x) == get<_Ip-1>(__y); 867 } 868}; 869 870template <> 871struct __tuple_equal<0> 872{ 873 template <class _Tp, class _Up> 874 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 875 bool operator()(const _Tp&, const _Up&) 876 { 877 return true; 878 } 879}; 880 881template <class ..._Tp, class ..._Up> 882inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 883bool 884operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) 885{ 886 return __tuple_equal<sizeof...(_Tp)>()(__x, __y); 887} 888 889template <class ..._Tp, class ..._Up> 890inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 891bool 892operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) 893{ 894 return !(__x == __y); 895} 896 897template <size_t _Ip> 898struct __tuple_less 899{ 900 template <class _Tp, class _Up> 901 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 902 bool operator()(const _Tp& __x, const _Up& __y) 903 { 904 return __tuple_less<_Ip-1>()(__x, __y) || 905 (!__tuple_less<_Ip-1>()(__y, __x) && get<_Ip-1>(__x) < get<_Ip-1>(__y)); 906 } 907}; 908 909template <> 910struct __tuple_less<0> 911{ 912 template <class _Tp, class _Up> 913 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 914 bool operator()(const _Tp&, const _Up&) 915 { 916 return false; 917 } 918}; 919 920template <class ..._Tp, class ..._Up> 921inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 922bool 923operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) 924{ 925 return __tuple_less<sizeof...(_Tp)>()(__x, __y); 926} 927 928template <class ..._Tp, class ..._Up> 929inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 930bool 931operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) 932{ 933 return __y < __x; 934} 935 936template <class ..._Tp, class ..._Up> 937inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 938bool 939operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) 940{ 941 return !(__x < __y); 942} 943 944template <class ..._Tp, class ..._Up> 945inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 946bool 947operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) 948{ 949 return !(__y < __x); 950} 951 952// tuple_cat 953 954template <class _Tp, class _Up> struct __tuple_cat_type; 955 956template <class ..._Ttypes, class ..._Utypes> 957struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> > 958{ 959 typedef tuple<_Ttypes..., _Utypes...> type; 960}; 961 962template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples> 963struct __tuple_cat_return_1 964{ 965}; 966 967template <class ..._Types, class _Tuple0> 968struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0> 969{ 970 typedef typename __tuple_cat_type<tuple<_Types...>, 971 typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type 972 type; 973}; 974 975template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples> 976struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...> 977 : public __tuple_cat_return_1< 978 typename __tuple_cat_type< 979 tuple<_Types...>, 980 typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type 981 >::type, 982 __tuple_like<typename remove_reference<_Tuple1>::type>::value, 983 _Tuple1, _Tuples...> 984{ 985}; 986 987template <class ..._Tuples> struct __tuple_cat_return; 988 989template <class _Tuple0, class ..._Tuples> 990struct __tuple_cat_return<_Tuple0, _Tuples...> 991 : public __tuple_cat_return_1<tuple<>, 992 __tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0, 993 _Tuples...> 994{ 995}; 996 997template <> 998struct __tuple_cat_return<> 999{ 1000 typedef tuple<> type; 1001}; 1002 1003inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1004tuple<> 1005tuple_cat() 1006{ 1007 return tuple<>(); 1008} 1009 1010template <class _Rp, class _Indices, class _Tuple0, class ..._Tuples> 1011struct __tuple_cat_return_ref_imp; 1012 1013template <class ..._Types, size_t ..._I0, class _Tuple0> 1014struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0> 1015{ 1016 typedef typename remove_reference<_Tuple0>::type _T0; 1017 typedef tuple<_Types..., typename __apply_cv<_Tuple0, 1018 typename tuple_element<_I0, _T0>::type>::type&&...> type; 1019}; 1020 1021template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples> 1022struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, 1023 _Tuple0, _Tuple1, _Tuples...> 1024 : public __tuple_cat_return_ref_imp< 1025 tuple<_Types..., typename __apply_cv<_Tuple0, 1026 typename tuple_element<_I0, 1027 typename remove_reference<_Tuple0>::type>::type>::type&&...>, 1028 typename __make_tuple_indices<tuple_size<typename 1029 remove_reference<_Tuple1>::type>::value>::type, 1030 _Tuple1, _Tuples...> 1031{ 1032}; 1033 1034template <class _Tuple0, class ..._Tuples> 1035struct __tuple_cat_return_ref 1036 : public __tuple_cat_return_ref_imp<tuple<>, 1037 typename __make_tuple_indices< 1038 tuple_size<typename remove_reference<_Tuple0>::type>::value 1039 >::type, _Tuple0, _Tuples...> 1040{ 1041}; 1042 1043template <class _Types, class _I0, class _J0> 1044struct __tuple_cat; 1045 1046template <class ..._Types, size_t ..._I0, size_t ..._J0> 1047struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> > 1048{ 1049 template <class _Tuple0> 1050 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1051 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type 1052 operator()(tuple<_Types...> __t, _Tuple0&& __t0) 1053 { 1054 return forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))..., 1055 get<_J0>(_VSTD::forward<_Tuple0>(__t0))...); 1056 } 1057 1058 template <class _Tuple0, class _Tuple1, class ..._Tuples> 1059 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1060 typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type 1061 operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls) 1062 { 1063 typedef typename remove_reference<_Tuple0>::type _T0; 1064 typedef typename remove_reference<_Tuple1>::type _T1; 1065 return __tuple_cat< 1066 tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>, 1067 typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type, 1068 typename __make_tuple_indices<tuple_size<_T1>::value>::type>() 1069 (forward_as_tuple( 1070 _VSTD::forward<_Types>(get<_I0>(__t))..., 1071 get<_J0>(_VSTD::forward<_Tuple0>(__t0))... 1072 ), 1073 _VSTD::forward<_Tuple1>(__t1), 1074 _VSTD::forward<_Tuples>(__tpls)...); 1075 } 1076}; 1077 1078template <class _Tuple0, class... _Tuples> 1079inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1080typename __tuple_cat_return<_Tuple0, _Tuples...>::type 1081tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) 1082{ 1083 typedef typename remove_reference<_Tuple0>::type _T0; 1084 return __tuple_cat<tuple<>, __tuple_indices<>, 1085 typename __make_tuple_indices<tuple_size<_T0>::value>::type>() 1086 (tuple<>(), _VSTD::forward<_Tuple0>(__t0), 1087 _VSTD::forward<_Tuples>(__tpls)...); 1088} 1089 1090template <class ..._Tp, class _Alloc> 1091struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<tuple<_Tp...>, _Alloc> 1092 : true_type {}; 1093 1094template <class _T1, class _T2> 1095template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2> 1096inline _LIBCPP_INLINE_VISIBILITY 1097pair<_T1, _T2>::pair(piecewise_construct_t, 1098 tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, 1099 __tuple_indices<_I1...>, __tuple_indices<_I2...>) 1100 : first(_VSTD::forward<_Args1>(get<_I1>( __first_args))...), 1101 second(_VSTD::forward<_Args2>(get<_I2>(__second_args))...) 1102{ 1103} 1104 1105#endif // _LIBCPP_HAS_NO_VARIADICS 1106 1107_LIBCPP_END_NAMESPACE_STD 1108 1109#endif // _LIBCPP_TUPLE 1110