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