14684ddb6SLionel Sambuc// -*- C++ -*- 24684ddb6SLionel Sambuc//===----------------------------------------------------------------------===// 34684ddb6SLionel Sambuc// 44684ddb6SLionel Sambuc// The LLVM Compiler Infrastructure 54684ddb6SLionel Sambuc// 64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open 74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details. 84684ddb6SLionel Sambuc// 94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===// 104684ddb6SLionel Sambuc 114684ddb6SLionel Sambuc#ifndef _LIBCPP___TUPLE 124684ddb6SLionel Sambuc#define _LIBCPP___TUPLE 134684ddb6SLionel Sambuc 144684ddb6SLionel Sambuc#include <__config> 154684ddb6SLionel Sambuc#include <cstddef> 164684ddb6SLionel Sambuc#include <type_traits> 174684ddb6SLionel Sambuc 184684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 194684ddb6SLionel Sambuc#pragma GCC system_header 204684ddb6SLionel Sambuc#endif 214684ddb6SLionel Sambuc 224684ddb6SLionel Sambuc 234684ddb6SLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD 244684ddb6SLionel Sambuc 254684ddb6SLionel Sambuctemplate <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size; 264684ddb6SLionel Sambuc 274684ddb6SLionel Sambuctemplate <class _Tp> 284684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY tuple_size<const _Tp> 294684ddb6SLionel Sambuc : public tuple_size<_Tp> {}; 304684ddb6SLionel Sambuc 314684ddb6SLionel Sambuctemplate <class _Tp> 324684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY tuple_size<volatile _Tp> 334684ddb6SLionel Sambuc : public tuple_size<_Tp> {}; 344684ddb6SLionel Sambuc 354684ddb6SLionel Sambuctemplate <class _Tp> 364684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY tuple_size<const volatile _Tp> 374684ddb6SLionel Sambuc : public tuple_size<_Tp> {}; 384684ddb6SLionel Sambuc 394684ddb6SLionel Sambuctemplate <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element; 404684ddb6SLionel Sambuc 414684ddb6SLionel Sambuctemplate <size_t _Ip, class _Tp> 424684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const _Tp> 434684ddb6SLionel Sambuc{ 444684ddb6SLionel Sambucpublic: 454684ddb6SLionel Sambuc typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type; 464684ddb6SLionel Sambuc}; 474684ddb6SLionel Sambuc 484684ddb6SLionel Sambuctemplate <size_t _Ip, class _Tp> 494684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, volatile _Tp> 504684ddb6SLionel Sambuc{ 514684ddb6SLionel Sambucpublic: 524684ddb6SLionel Sambuc typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type; 534684ddb6SLionel Sambuc}; 544684ddb6SLionel Sambuc 554684ddb6SLionel Sambuctemplate <size_t _Ip, class _Tp> 564684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const volatile _Tp> 574684ddb6SLionel Sambuc{ 584684ddb6SLionel Sambucpublic: 594684ddb6SLionel Sambuc typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type; 604684ddb6SLionel Sambuc}; 614684ddb6SLionel Sambuc 624684ddb6SLionel Sambuctemplate <class _Tp> struct __tuple_like : false_type {}; 634684ddb6SLionel Sambuc 644684ddb6SLionel Sambuctemplate <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {}; 654684ddb6SLionel Sambuctemplate <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {}; 664684ddb6SLionel Sambuctemplate <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {}; 674684ddb6SLionel Sambuc 68*0a6a1f1dSLionel Sambuc// tuple specializations 69*0a6a1f1dSLionel Sambuc 70*0a6a1f1dSLionel Sambuc#if !defined(_LIBCPP_HAS_NO_VARIADICS) 71*0a6a1f1dSLionel Sambuctemplate <class ..._Tp> class _LIBCPP_TYPE_VIS_ONLY tuple; 72*0a6a1f1dSLionel Sambuc 734684ddb6SLionel Sambuctemplate <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {}; 744684ddb6SLionel Sambuc 754684ddb6SLionel Sambuctemplate <size_t _Ip, class ..._Tp> 764684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 774684ddb6SLionel Sambuctypename tuple_element<_Ip, tuple<_Tp...> >::type& 784684ddb6SLionel Sambucget(tuple<_Tp...>&) _NOEXCEPT; 794684ddb6SLionel Sambuc 804684ddb6SLionel Sambuctemplate <size_t _Ip, class ..._Tp> 814684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 824684ddb6SLionel Sambucconst typename tuple_element<_Ip, tuple<_Tp...> >::type& 834684ddb6SLionel Sambucget(const tuple<_Tp...>&) _NOEXCEPT; 844684ddb6SLionel Sambuc 854684ddb6SLionel Sambuctemplate <size_t _Ip, class ..._Tp> 864684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 874684ddb6SLionel Sambuctypename tuple_element<_Ip, tuple<_Tp...> >::type&& 884684ddb6SLionel Sambucget(tuple<_Tp...>&&) _NOEXCEPT; 89*0a6a1f1dSLionel Sambuc#endif 90*0a6a1f1dSLionel Sambuc 91*0a6a1f1dSLionel Sambuc// pair specializations 92*0a6a1f1dSLionel Sambuc 93*0a6a1f1dSLionel Sambuctemplate <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY pair; 94*0a6a1f1dSLionel Sambuc 95*0a6a1f1dSLionel Sambuctemplate <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {}; 964684ddb6SLionel Sambuc 974684ddb6SLionel Sambuctemplate <size_t _Ip, class _T1, class _T2> 984684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 994684ddb6SLionel Sambuctypename tuple_element<_Ip, pair<_T1, _T2> >::type& 1004684ddb6SLionel Sambucget(pair<_T1, _T2>&) _NOEXCEPT; 1014684ddb6SLionel Sambuc 1024684ddb6SLionel Sambuctemplate <size_t _Ip, class _T1, class _T2> 1034684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1044684ddb6SLionel Sambucconst typename tuple_element<_Ip, pair<_T1, _T2> >::type& 1054684ddb6SLionel Sambucget(const pair<_T1, _T2>&) _NOEXCEPT; 1064684ddb6SLionel Sambuc 107*0a6a1f1dSLionel Sambuc#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) 1084684ddb6SLionel Sambuctemplate <size_t _Ip, class _T1, class _T2> 1094684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1104684ddb6SLionel Sambuctypename tuple_element<_Ip, pair<_T1, _T2> >::type&& 1114684ddb6SLionel Sambucget(pair<_T1, _T2>&&) _NOEXCEPT; 112*0a6a1f1dSLionel Sambuc#endif 113*0a6a1f1dSLionel Sambuc 114*0a6a1f1dSLionel Sambuc// array specializations 115*0a6a1f1dSLionel Sambuc 116*0a6a1f1dSLionel Sambuctemplate <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY array; 117*0a6a1f1dSLionel Sambuc 118*0a6a1f1dSLionel Sambuctemplate <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {}; 1194684ddb6SLionel Sambuc 1204684ddb6SLionel Sambuctemplate <size_t _Ip, class _Tp, size_t _Size> 1214684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1224684ddb6SLionel Sambuc_Tp& 1234684ddb6SLionel Sambucget(array<_Tp, _Size>&) _NOEXCEPT; 1244684ddb6SLionel Sambuc 1254684ddb6SLionel Sambuctemplate <size_t _Ip, class _Tp, size_t _Size> 1264684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1274684ddb6SLionel Sambucconst _Tp& 1284684ddb6SLionel Sambucget(const array<_Tp, _Size>&) _NOEXCEPT; 1294684ddb6SLionel Sambuc 130*0a6a1f1dSLionel Sambuc#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) 1314684ddb6SLionel Sambuctemplate <size_t _Ip, class _Tp, size_t _Size> 1324684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1334684ddb6SLionel Sambuc_Tp&& 1344684ddb6SLionel Sambucget(array<_Tp, _Size>&&) _NOEXCEPT; 135*0a6a1f1dSLionel Sambuc#endif 136*0a6a1f1dSLionel Sambuc 137*0a6a1f1dSLionel Sambuc#if !defined(_LIBCPP_HAS_NO_VARIADICS) 138*0a6a1f1dSLionel Sambuc 139*0a6a1f1dSLionel Sambuc// __lazy_and 140*0a6a1f1dSLionel Sambuc 141*0a6a1f1dSLionel Sambuctemplate <bool _Last, class ..._Preds> 142*0a6a1f1dSLionel Sambucstruct __lazy_and_impl; 143*0a6a1f1dSLionel Sambuc 144*0a6a1f1dSLionel Sambuctemplate <class ..._Preds> 145*0a6a1f1dSLionel Sambucstruct __lazy_and_impl<false, _Preds...> : false_type {}; 146*0a6a1f1dSLionel Sambuc 147*0a6a1f1dSLionel Sambuctemplate <> 148*0a6a1f1dSLionel Sambucstruct __lazy_and_impl<true> : true_type {}; 149*0a6a1f1dSLionel Sambuc 150*0a6a1f1dSLionel Sambuctemplate <class _Pred> 151*0a6a1f1dSLionel Sambucstruct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {}; 152*0a6a1f1dSLionel Sambuc 153*0a6a1f1dSLionel Sambuctemplate <class _Hp, class ..._Tp> 154*0a6a1f1dSLionel Sambucstruct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {}; 155*0a6a1f1dSLionel Sambuc 156*0a6a1f1dSLionel Sambuctemplate <class _P1, class ..._Pr> 157*0a6a1f1dSLionel Sambucstruct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {}; 158*0a6a1f1dSLionel Sambuc 159*0a6a1f1dSLionel Sambuc// __lazy_not 160*0a6a1f1dSLionel Sambuc 161*0a6a1f1dSLionel Sambuctemplate <class _Pred> 162*0a6a1f1dSLionel Sambucstruct __lazy_not : integral_constant<bool, !_Pred::type::value> {}; 1634684ddb6SLionel Sambuc 1644684ddb6SLionel Sambuc// __make_tuple_indices 1654684ddb6SLionel Sambuc 1664684ddb6SLionel Sambuctemplate <size_t...> struct __tuple_indices {}; 1674684ddb6SLionel Sambuc 1684684ddb6SLionel Sambuctemplate <size_t _Sp, class _IntTuple, size_t _Ep> 1694684ddb6SLionel Sambucstruct __make_indices_imp; 1704684ddb6SLionel Sambuc 1714684ddb6SLionel Sambuctemplate <size_t _Sp, size_t ..._Indices, size_t _Ep> 1724684ddb6SLionel Sambucstruct __make_indices_imp<_Sp, __tuple_indices<_Indices...>, _Ep> 1734684ddb6SLionel Sambuc{ 1744684ddb6SLionel Sambuc typedef typename __make_indices_imp<_Sp+1, __tuple_indices<_Indices..., _Sp>, _Ep>::type type; 1754684ddb6SLionel Sambuc}; 1764684ddb6SLionel Sambuc 1774684ddb6SLionel Sambuctemplate <size_t _Ep, size_t ..._Indices> 1784684ddb6SLionel Sambucstruct __make_indices_imp<_Ep, __tuple_indices<_Indices...>, _Ep> 1794684ddb6SLionel Sambuc{ 1804684ddb6SLionel Sambuc typedef __tuple_indices<_Indices...> type; 1814684ddb6SLionel Sambuc}; 1824684ddb6SLionel Sambuc 1834684ddb6SLionel Sambuctemplate <size_t _Ep, size_t _Sp = 0> 1844684ddb6SLionel Sambucstruct __make_tuple_indices 1854684ddb6SLionel Sambuc{ 1864684ddb6SLionel Sambuc static_assert(_Sp <= _Ep, "__make_tuple_indices input error"); 1874684ddb6SLionel Sambuc typedef typename __make_indices_imp<_Sp, __tuple_indices<>, _Ep>::type type; 1884684ddb6SLionel Sambuc}; 1894684ddb6SLionel Sambuc 1904684ddb6SLionel Sambuc// __tuple_types 1914684ddb6SLionel Sambuc 1924684ddb6SLionel Sambuctemplate <class ..._Tp> struct __tuple_types {}; 1934684ddb6SLionel Sambuc 1944684ddb6SLionel Sambuctemplate <size_t _Ip> 1954684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<> > 1964684ddb6SLionel Sambuc{ 1974684ddb6SLionel Sambucpublic: 1984684ddb6SLionel Sambuc static_assert(_Ip == 0, "tuple_element index out of range"); 1994684ddb6SLionel Sambuc static_assert(_Ip != 0, "tuple_element index out of range"); 2004684ddb6SLionel Sambuc}; 2014684ddb6SLionel Sambuc 2024684ddb6SLionel Sambuctemplate <class _Hp, class ..._Tp> 2034684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY tuple_element<0, __tuple_types<_Hp, _Tp...> > 2044684ddb6SLionel Sambuc{ 2054684ddb6SLionel Sambucpublic: 2064684ddb6SLionel Sambuc typedef _Hp type; 2074684ddb6SLionel Sambuc}; 2084684ddb6SLionel Sambuc 2094684ddb6SLionel Sambuctemplate <size_t _Ip, class _Hp, class ..._Tp> 2104684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<_Hp, _Tp...> > 2114684ddb6SLionel Sambuc{ 2124684ddb6SLionel Sambucpublic: 2134684ddb6SLionel Sambuc typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type; 2144684ddb6SLionel Sambuc}; 2154684ddb6SLionel Sambuc 2164684ddb6SLionel Sambuctemplate <class ..._Tp> 2174684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY tuple_size<__tuple_types<_Tp...> > 2184684ddb6SLionel Sambuc : public integral_constant<size_t, sizeof...(_Tp)> 2194684ddb6SLionel Sambuc{ 2204684ddb6SLionel Sambuc}; 2214684ddb6SLionel Sambuc 2224684ddb6SLionel Sambuctemplate <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {}; 2234684ddb6SLionel Sambuc 2244684ddb6SLionel Sambuc// __make_tuple_types 2254684ddb6SLionel Sambuc 2264684ddb6SLionel Sambuc// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a 2274684ddb6SLionel Sambuc// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep). 2284684ddb6SLionel Sambuc// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a 2294684ddb6SLionel Sambuc// lvalue_reference type, then __tuple_types<_Types&...> is the result. 2304684ddb6SLionel Sambuc 2314684ddb6SLionel Sambuctemplate <class _TupleTypes, class _Tp, size_t _Sp, size_t _Ep> 2324684ddb6SLionel Sambucstruct __make_tuple_types_imp; 2334684ddb6SLionel Sambuc 2344684ddb6SLionel Sambuctemplate <class ..._Types, class _Tp, size_t _Sp, size_t _Ep> 2354684ddb6SLionel Sambucstruct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep> 2364684ddb6SLionel Sambuc{ 2374684ddb6SLionel Sambuc typedef typename remove_reference<_Tp>::type _Tpr; 2384684ddb6SLionel Sambuc typedef typename __make_tuple_types_imp<__tuple_types<_Types..., 2394684ddb6SLionel Sambuc typename conditional<is_lvalue_reference<_Tp>::value, 2404684ddb6SLionel Sambuc typename tuple_element<_Sp, _Tpr>::type&, 2414684ddb6SLionel Sambuc typename tuple_element<_Sp, _Tpr>::type>::type>, 2424684ddb6SLionel Sambuc _Tp, _Sp+1, _Ep>::type type; 2434684ddb6SLionel Sambuc}; 2444684ddb6SLionel Sambuc 2454684ddb6SLionel Sambuctemplate <class ..._Types, class _Tp, size_t _Ep> 2464684ddb6SLionel Sambucstruct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Ep, _Ep> 2474684ddb6SLionel Sambuc{ 2484684ddb6SLionel Sambuc typedef __tuple_types<_Types...> type; 2494684ddb6SLionel Sambuc}; 2504684ddb6SLionel Sambuc 2514684ddb6SLionel Sambuctemplate <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0> 2524684ddb6SLionel Sambucstruct __make_tuple_types 2534684ddb6SLionel Sambuc{ 2544684ddb6SLionel Sambuc static_assert(_Sp <= _Ep, "__make_tuple_types input error"); 2554684ddb6SLionel Sambuc typedef typename __make_tuple_types_imp<__tuple_types<>, _Tp, _Sp, _Ep>::type type; 2564684ddb6SLionel Sambuc}; 2574684ddb6SLionel Sambuc 2584684ddb6SLionel Sambuc// __tuple_convertible 2594684ddb6SLionel Sambuc 260*0a6a1f1dSLionel Sambuctemplate <class, class> 2614684ddb6SLionel Sambucstruct __tuple_convertible_imp : public false_type {}; 2624684ddb6SLionel Sambuc 2634684ddb6SLionel Sambuctemplate <class _Tp0, class ..._Tp, class _Up0, class ..._Up> 264*0a6a1f1dSLionel Sambucstruct __tuple_convertible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> > 2654684ddb6SLionel Sambuc : public integral_constant<bool, 2664684ddb6SLionel Sambuc is_convertible<_Tp0, _Up0>::value && 267*0a6a1f1dSLionel Sambuc __tuple_convertible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {}; 2684684ddb6SLionel Sambuc 2694684ddb6SLionel Sambuctemplate <> 270*0a6a1f1dSLionel Sambucstruct __tuple_convertible_imp<__tuple_types<>, __tuple_types<> > 2714684ddb6SLionel Sambuc : public true_type {}; 2724684ddb6SLionel Sambuc 273*0a6a1f1dSLionel Sambuctemplate <bool, class, class> 274*0a6a1f1dSLionel Sambucstruct __tuple_convertible_apply : public false_type {}; 275*0a6a1f1dSLionel Sambuc 276*0a6a1f1dSLionel Sambuctemplate <class _Tp, class _Up> 277*0a6a1f1dSLionel Sambucstruct __tuple_convertible_apply<true, _Tp, _Up> 278*0a6a1f1dSLionel Sambuc : public __tuple_convertible_imp< 279*0a6a1f1dSLionel Sambuc typename __make_tuple_types<_Tp>::type 280*0a6a1f1dSLionel Sambuc , typename __make_tuple_types<_Up>::type 281*0a6a1f1dSLionel Sambuc > 282*0a6a1f1dSLionel Sambuc{}; 283*0a6a1f1dSLionel Sambuc 2844684ddb6SLionel Sambuctemplate <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, 2854684ddb6SLionel Sambuc bool = __tuple_like<_Up>::value> 2864684ddb6SLionel Sambucstruct __tuple_convertible 2874684ddb6SLionel Sambuc : public false_type {}; 2884684ddb6SLionel Sambuc 2894684ddb6SLionel Sambuctemplate <class _Tp, class _Up> 2904684ddb6SLionel Sambucstruct __tuple_convertible<_Tp, _Up, true, true> 291*0a6a1f1dSLionel Sambuc : public __tuple_convertible_apply<tuple_size<typename remove_reference<_Tp>::type>::value == 292*0a6a1f1dSLionel Sambuc tuple_size<_Up>::value, _Tp, _Up> 2934684ddb6SLionel Sambuc{}; 2944684ddb6SLionel Sambuc 2954684ddb6SLionel Sambuc// __tuple_constructible 2964684ddb6SLionel Sambuc 297*0a6a1f1dSLionel Sambuctemplate <class, class> 2984684ddb6SLionel Sambucstruct __tuple_constructible_imp : public false_type {}; 2994684ddb6SLionel Sambuc 3004684ddb6SLionel Sambuctemplate <class _Tp0, class ..._Tp, class _Up0, class ..._Up> 301*0a6a1f1dSLionel Sambucstruct __tuple_constructible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> > 3024684ddb6SLionel Sambuc : public integral_constant<bool, 3034684ddb6SLionel Sambuc is_constructible<_Up0, _Tp0>::value && 304*0a6a1f1dSLionel Sambuc __tuple_constructible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {}; 3054684ddb6SLionel Sambuc 3064684ddb6SLionel Sambuctemplate <> 307*0a6a1f1dSLionel Sambucstruct __tuple_constructible_imp<__tuple_types<>, __tuple_types<> > 3084684ddb6SLionel Sambuc : public true_type {}; 3094684ddb6SLionel Sambuc 310*0a6a1f1dSLionel Sambuctemplate <bool _SameSize, class, class> 311*0a6a1f1dSLionel Sambucstruct __tuple_constructible_apply : public false_type {}; 312*0a6a1f1dSLionel Sambuc 313*0a6a1f1dSLionel Sambuctemplate <class _Tp, class _Up> 314*0a6a1f1dSLionel Sambucstruct __tuple_constructible_apply<true, _Tp, _Up> 315*0a6a1f1dSLionel Sambuc : public __tuple_constructible_imp< 316*0a6a1f1dSLionel Sambuc typename __make_tuple_types<_Tp>::type 317*0a6a1f1dSLionel Sambuc , typename __make_tuple_types<_Up>::type 318*0a6a1f1dSLionel Sambuc > 319*0a6a1f1dSLionel Sambuc{}; 320*0a6a1f1dSLionel Sambuc 3214684ddb6SLionel Sambuctemplate <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, 3224684ddb6SLionel Sambuc bool = __tuple_like<_Up>::value> 3234684ddb6SLionel Sambucstruct __tuple_constructible 3244684ddb6SLionel Sambuc : public false_type {}; 3254684ddb6SLionel Sambuc 3264684ddb6SLionel Sambuctemplate <class _Tp, class _Up> 3274684ddb6SLionel Sambucstruct __tuple_constructible<_Tp, _Up, true, true> 328*0a6a1f1dSLionel Sambuc : public __tuple_constructible_apply<tuple_size<typename remove_reference<_Tp>::type>::value == 329*0a6a1f1dSLionel Sambuc tuple_size<_Up>::value, _Tp, _Up> 3304684ddb6SLionel Sambuc{}; 3314684ddb6SLionel Sambuc 3324684ddb6SLionel Sambuc// __tuple_assignable 3334684ddb6SLionel Sambuc 334*0a6a1f1dSLionel Sambuctemplate <class, class> 3354684ddb6SLionel Sambucstruct __tuple_assignable_imp : public false_type {}; 3364684ddb6SLionel Sambuc 3374684ddb6SLionel Sambuctemplate <class _Tp0, class ..._Tp, class _Up0, class ..._Up> 338*0a6a1f1dSLionel Sambucstruct __tuple_assignable_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> > 3394684ddb6SLionel Sambuc : public integral_constant<bool, 3404684ddb6SLionel Sambuc is_assignable<_Up0&, _Tp0>::value && 341*0a6a1f1dSLionel Sambuc __tuple_assignable_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {}; 3424684ddb6SLionel Sambuc 3434684ddb6SLionel Sambuctemplate <> 344*0a6a1f1dSLionel Sambucstruct __tuple_assignable_imp<__tuple_types<>, __tuple_types<> > 3454684ddb6SLionel Sambuc : public true_type {}; 3464684ddb6SLionel Sambuc 347*0a6a1f1dSLionel Sambuctemplate <bool, class, class> 348*0a6a1f1dSLionel Sambucstruct __tuple_assignable_apply : public false_type {}; 349*0a6a1f1dSLionel Sambuc 350*0a6a1f1dSLionel Sambuctemplate <class _Tp, class _Up> 351*0a6a1f1dSLionel Sambucstruct __tuple_assignable_apply<true, _Tp, _Up> 352*0a6a1f1dSLionel Sambuc : __tuple_assignable_imp< 353*0a6a1f1dSLionel Sambuc typename __make_tuple_types<_Tp>::type 354*0a6a1f1dSLionel Sambuc , typename __make_tuple_types<_Up>::type 355*0a6a1f1dSLionel Sambuc > 356*0a6a1f1dSLionel Sambuc{}; 357*0a6a1f1dSLionel Sambuc 3584684ddb6SLionel Sambuctemplate <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, 3594684ddb6SLionel Sambuc bool = __tuple_like<_Up>::value> 3604684ddb6SLionel Sambucstruct __tuple_assignable 3614684ddb6SLionel Sambuc : public false_type {}; 3624684ddb6SLionel Sambuc 3634684ddb6SLionel Sambuctemplate <class _Tp, class _Up> 3644684ddb6SLionel Sambucstruct __tuple_assignable<_Tp, _Up, true, true> 365*0a6a1f1dSLionel Sambuc : public __tuple_assignable_apply<tuple_size<typename remove_reference<_Tp>::type>::value == 366*0a6a1f1dSLionel Sambuc tuple_size<_Up>::value, _Tp, _Up> 3674684ddb6SLionel Sambuc{}; 3684684ddb6SLionel Sambuc 3694684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_VARIADICS 3704684ddb6SLionel Sambuc 371*0a6a1f1dSLionel Sambuc_LIBCPP_END_NAMESPACE_STD 372*0a6a1f1dSLionel Sambuc 3734684ddb6SLionel Sambuc#endif // _LIBCPP___TUPLE 374