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