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