Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===----------------------------------------------------------------------===// |
| 3 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 6 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP___TUPLE |
| 12 | #define _LIBCPP___TUPLE |
| 13 | |
| 14 | #include <__config> |
| 15 | #include <cstddef> |
| 16 | #include <type_traits> |
| 17 | |
Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 18 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 19 | #pragma GCC system_header |
Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 20 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 21 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 22 | |
| 23 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 25 | template <class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_size; |
Eric Fiselier | 4084384 | 2017-01-02 23:54:13 +0000 | [diff] [blame] | 26 | |
Eric Fiselier | 06a0feb | 2017-01-04 22:38:46 +0000 | [diff] [blame] | 27 | #if !defined(_LIBCPP_CXX03_LANG) |
| 28 | template <class _Tp, class...> |
| 29 | using __enable_if_tuple_size_imp = _Tp; |
Eric Fiselier | 4084384 | 2017-01-02 23:54:13 +0000 | [diff] [blame] | 30 | |
| 31 | template <class _Tp> |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 32 | class _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< |
Eric Fiselier | 06a0feb | 2017-01-04 22:38:46 +0000 | [diff] [blame] | 33 | const _Tp, |
| 34 | typename enable_if<!is_volatile<_Tp>::value>::type, |
| 35 | integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> |
| 36 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; |
Howard Hinnant | 86ed8ae | 2010-11-17 19:22:43 +0000 | [diff] [blame] | 37 | |
| 38 | template <class _Tp> |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 39 | class _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< |
Eric Fiselier | 06a0feb | 2017-01-04 22:38:46 +0000 | [diff] [blame] | 40 | volatile _Tp, |
| 41 | typename enable_if<!is_const<_Tp>::value>::type, |
| 42 | integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> |
| 43 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; |
Howard Hinnant | 86ed8ae | 2010-11-17 19:22:43 +0000 | [diff] [blame] | 44 | |
| 45 | template <class _Tp> |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 46 | class _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< |
Eric Fiselier | 06a0feb | 2017-01-04 22:38:46 +0000 | [diff] [blame] | 47 | const volatile _Tp, |
| 48 | integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> |
| 49 | : public integral_constant<size_t, tuple_size<_Tp>::value> {}; |
Howard Hinnant | 86ed8ae | 2010-11-17 19:22:43 +0000 | [diff] [blame] | 50 | |
Eric Fiselier | 06a0feb | 2017-01-04 22:38:46 +0000 | [diff] [blame] | 51 | #else |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 52 | template <class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {}; |
| 53 | template <class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {}; |
| 54 | template <class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {}; |
Eric Fiselier | 06a0feb | 2017-01-04 22:38:46 +0000 | [diff] [blame] | 55 | #endif |
Howard Hinnant | 86ed8ae | 2010-11-17 19:22:43 +0000 | [diff] [blame] | 56 | |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 57 | template <size_t _Ip, class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_element; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 58 | |
Howard Hinnant | 86ed8ae | 2010-11-17 19:22:43 +0000 | [diff] [blame] | 59 | template <size_t _Ip, class _Tp> |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 60 | class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp> |
Howard Hinnant | 86ed8ae | 2010-11-17 19:22:43 +0000 | [diff] [blame] | 61 | { |
| 62 | public: |
| 63 | typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type; |
| 64 | }; |
| 65 | |
| 66 | template <size_t _Ip, class _Tp> |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 67 | class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp> |
Howard Hinnant | 86ed8ae | 2010-11-17 19:22:43 +0000 | [diff] [blame] | 68 | { |
| 69 | public: |
| 70 | typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type; |
| 71 | }; |
| 72 | |
| 73 | template <size_t _Ip, class _Tp> |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 74 | class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> |
Howard Hinnant | 86ed8ae | 2010-11-17 19:22:43 +0000 | [diff] [blame] | 75 | { |
| 76 | public: |
| 77 | typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type; |
| 78 | }; |
| 79 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 80 | template <class _Tp> struct __tuple_like : false_type {}; |
| 81 | |
Howard Hinnant | 0e1493e | 2010-12-11 20:47:50 +0000 | [diff] [blame] | 82 | template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {}; |
| 83 | template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {}; |
| 84 | template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {}; |
| 85 | |
Eric Fiselier | 8e706d2 | 2015-03-17 15:08:03 +0000 | [diff] [blame] | 86 | // tuple specializations |
| 87 | |
Eric Fiselier | 191f075 | 2017-04-19 01:23:39 +0000 | [diff] [blame] | 88 | #ifndef _LIBCPP_CXX03_LANG |
Eric Fiselier | a3ccd96 | 2016-06-30 22:34:43 +0000 | [diff] [blame] | 89 | |
| 90 | template <size_t...> struct __tuple_indices {}; |
| 91 | |
| 92 | template <class _IdxType, _IdxType... _Values> |
| 93 | struct __integer_sequence { |
| 94 | template <template <class _OIdxType, _OIdxType...> class _ToIndexSeq, class _ToIndexType> |
| 95 | using __convert = _ToIndexSeq<_ToIndexType, _Values...>; |
| 96 | |
| 97 | template <size_t _Sp> |
| 98 | using __to_tuple_indices = __tuple_indices<(_Values + _Sp)...>; |
| 99 | }; |
| 100 | |
| 101 | #if !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) |
| 102 | namespace __detail { |
| 103 | |
| 104 | template<typename _Tp, size_t ..._Extra> struct __repeat; |
| 105 | template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> { |
| 106 | typedef __integer_sequence<_Tp, |
| 107 | _Np..., |
| 108 | sizeof...(_Np) + _Np..., |
| 109 | 2 * sizeof...(_Np) + _Np..., |
| 110 | 3 * sizeof...(_Np) + _Np..., |
| 111 | 4 * sizeof...(_Np) + _Np..., |
| 112 | 5 * sizeof...(_Np) + _Np..., |
| 113 | 6 * sizeof...(_Np) + _Np..., |
| 114 | 7 * sizeof...(_Np) + _Np..., |
| 115 | _Extra...> type; |
| 116 | }; |
| 117 | |
| 118 | template<size_t _Np> struct __parity; |
| 119 | template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {}; |
| 120 | |
| 121 | template<> struct __make<0> { typedef __integer_sequence<size_t> type; }; |
| 122 | template<> struct __make<1> { typedef __integer_sequence<size_t, 0> type; }; |
| 123 | template<> struct __make<2> { typedef __integer_sequence<size_t, 0, 1> type; }; |
| 124 | template<> struct __make<3> { typedef __integer_sequence<size_t, 0, 1, 2> type; }; |
| 125 | template<> struct __make<4> { typedef __integer_sequence<size_t, 0, 1, 2, 3> type; }; |
| 126 | template<> struct __make<5> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4> type; }; |
| 127 | template<> struct __make<6> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5> type; }; |
| 128 | template<> struct __make<7> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5, 6> type; }; |
| 129 | |
| 130 | template<> struct __parity<0> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type> {}; }; |
| 131 | template<> struct __parity<1> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 1> {}; }; |
| 132 | template<> struct __parity<2> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 2, _Np - 1> {}; }; |
| 133 | template<> struct __parity<3> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 3, _Np - 2, _Np - 1> {}; }; |
| 134 | template<> struct __parity<4> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; |
| 135 | template<> struct __parity<5> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; |
| 136 | template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; |
| 137 | template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; |
| 138 | |
| 139 | } // namespace detail |
| 140 | |
| 141 | #endif // !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) |
| 142 | |
| 143 | #if __has_builtin(__make_integer_seq) |
| 144 | template <size_t _Ep, size_t _Sp> |
| 145 | using __make_indices_imp = |
| 146 | typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template |
| 147 | __to_tuple_indices<_Sp>; |
| 148 | #else |
| 149 | template <size_t _Ep, size_t _Sp> |
| 150 | using __make_indices_imp = |
| 151 | typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>; |
| 152 | |
| 153 | #endif |
| 154 | |
| 155 | template <size_t _Ep, size_t _Sp = 0> |
| 156 | struct __make_tuple_indices |
| 157 | { |
| 158 | static_assert(_Sp <= _Ep, "__make_tuple_indices input error"); |
| 159 | typedef __make_indices_imp<_Ep, _Sp> type; |
| 160 | }; |
| 161 | |
| 162 | |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 163 | template <class ..._Tp> class _LIBCPP_TEMPLATE_VIS tuple; |
Eric Fiselier | 8e706d2 | 2015-03-17 15:08:03 +0000 | [diff] [blame] | 164 | |
Howard Hinnant | f83417b | 2011-01-24 16:07:25 +0000 | [diff] [blame] | 165 | template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {}; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 166 | |
Eric Fiselier | e1445fd | 2016-07-25 04:32:07 +0000 | [diff] [blame] | 167 | template <class ..._Tp> |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 168 | class _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> > |
Eric Fiselier | e1445fd | 2016-07-25 04:32:07 +0000 | [diff] [blame] | 169 | : public integral_constant<size_t, sizeof...(_Tp)> |
| 170 | { |
| 171 | }; |
| 172 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 173 | template <size_t _Ip, class ..._Tp> |
Marshall Clow | 8fc4f5a | 2013-07-17 18:25:36 +0000 | [diff] [blame] | 174 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
Howard Hinnant | f83417b | 2011-01-24 16:07:25 +0000 | [diff] [blame] | 175 | typename tuple_element<_Ip, tuple<_Tp...> >::type& |
Howard Hinnant | a5e0121 | 2011-05-27 19:08:18 +0000 | [diff] [blame] | 176 | get(tuple<_Tp...>&) _NOEXCEPT; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 177 | |
| 178 | template <size_t _Ip, class ..._Tp> |
Marshall Clow | 8fc4f5a | 2013-07-17 18:25:36 +0000 | [diff] [blame] | 179 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
Howard Hinnant | f83417b | 2011-01-24 16:07:25 +0000 | [diff] [blame] | 180 | const typename tuple_element<_Ip, tuple<_Tp...> >::type& |
Howard Hinnant | a5e0121 | 2011-05-27 19:08:18 +0000 | [diff] [blame] | 181 | get(const tuple<_Tp...>&) _NOEXCEPT; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 182 | |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 183 | template <size_t _Ip, class ..._Tp> |
Marshall Clow | 8fc4f5a | 2013-07-17 18:25:36 +0000 | [diff] [blame] | 184 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
Howard Hinnant | f83417b | 2011-01-24 16:07:25 +0000 | [diff] [blame] | 185 | typename tuple_element<_Ip, tuple<_Tp...> >::type&& |
Howard Hinnant | a5e0121 | 2011-05-27 19:08:18 +0000 | [diff] [blame] | 186 | get(tuple<_Tp...>&&) _NOEXCEPT; |
Eric Fiselier | 199bee0 | 2015-12-18 00:36:55 +0000 | [diff] [blame] | 187 | |
| 188 | template <size_t _Ip, class ..._Tp> |
| 189 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 190 | const typename tuple_element<_Ip, tuple<_Tp...> >::type&& |
| 191 | get(const tuple<_Tp...>&&) _NOEXCEPT; |
Eric Fiselier | 191f075 | 2017-04-19 01:23:39 +0000 | [diff] [blame] | 192 | |
| 193 | #endif // !defined(_LIBCPP_CXX03_LANG) |
Eric Fiselier | 8e706d2 | 2015-03-17 15:08:03 +0000 | [diff] [blame] | 194 | |
| 195 | // pair specializations |
| 196 | |
Eric Fiselier | 8e706d2 | 2015-03-17 15:08:03 +0000 | [diff] [blame] | 197 | template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {}; |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 198 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 199 | template <size_t _Ip, class _T1, class _T2> |
Marshall Clow | 8fc4f5a | 2013-07-17 18:25:36 +0000 | [diff] [blame] | 200 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 201 | typename tuple_element<_Ip, pair<_T1, _T2> >::type& |
Howard Hinnant | a5e0121 | 2011-05-27 19:08:18 +0000 | [diff] [blame] | 202 | get(pair<_T1, _T2>&) _NOEXCEPT; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 203 | |
| 204 | template <size_t _Ip, class _T1, class _T2> |
Marshall Clow | 8fc4f5a | 2013-07-17 18:25:36 +0000 | [diff] [blame] | 205 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 206 | const typename tuple_element<_Ip, pair<_T1, _T2> >::type& |
Howard Hinnant | a5e0121 | 2011-05-27 19:08:18 +0000 | [diff] [blame] | 207 | get(const pair<_T1, _T2>&) _NOEXCEPT; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 208 | |
Eric Fiselier | 191f075 | 2017-04-19 01:23:39 +0000 | [diff] [blame] | 209 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 210 | template <size_t _Ip, class _T1, class _T2> |
Marshall Clow | 8fc4f5a | 2013-07-17 18:25:36 +0000 | [diff] [blame] | 211 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 212 | typename tuple_element<_Ip, pair<_T1, _T2> >::type&& |
Howard Hinnant | a5e0121 | 2011-05-27 19:08:18 +0000 | [diff] [blame] | 213 | get(pair<_T1, _T2>&&) _NOEXCEPT; |
Eric Fiselier | 199bee0 | 2015-12-18 00:36:55 +0000 | [diff] [blame] | 214 | |
| 215 | template <size_t _Ip, class _T1, class _T2> |
| 216 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 217 | const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& |
| 218 | get(const pair<_T1, _T2>&&) _NOEXCEPT; |
Eric Fiselier | 8e706d2 | 2015-03-17 15:08:03 +0000 | [diff] [blame] | 219 | #endif |
| 220 | |
| 221 | // array specializations |
| 222 | |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 223 | template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array; |
Eric Fiselier | 8e706d2 | 2015-03-17 15:08:03 +0000 | [diff] [blame] | 224 | |
| 225 | template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {}; |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 226 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 227 | template <size_t _Ip, class _Tp, size_t _Size> |
Marshall Clow | 8fc4f5a | 2013-07-17 18:25:36 +0000 | [diff] [blame] | 228 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 229 | _Tp& |
Howard Hinnant | f0562af | 2011-05-31 21:06:33 +0000 | [diff] [blame] | 230 | get(array<_Tp, _Size>&) _NOEXCEPT; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 231 | |
| 232 | template <size_t _Ip, class _Tp, size_t _Size> |
Marshall Clow | 8fc4f5a | 2013-07-17 18:25:36 +0000 | [diff] [blame] | 233 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 234 | const _Tp& |
Howard Hinnant | f0562af | 2011-05-31 21:06:33 +0000 | [diff] [blame] | 235 | get(const array<_Tp, _Size>&) _NOEXCEPT; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 236 | |
Eric Fiselier | 191f075 | 2017-04-19 01:23:39 +0000 | [diff] [blame] | 237 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 238 | template <size_t _Ip, class _Tp, size_t _Size> |
Marshall Clow | 8fc4f5a | 2013-07-17 18:25:36 +0000 | [diff] [blame] | 239 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
Howard Hinnant | cd2254b | 2010-11-17 19:52:17 +0000 | [diff] [blame] | 240 | _Tp&& |
Howard Hinnant | f0562af | 2011-05-31 21:06:33 +0000 | [diff] [blame] | 241 | get(array<_Tp, _Size>&&) _NOEXCEPT; |
Eric Fiselier | 199bee0 | 2015-12-18 00:36:55 +0000 | [diff] [blame] | 242 | |
| 243 | template <size_t _Ip, class _Tp, size_t _Size> |
| 244 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 245 | const _Tp&& |
| 246 | get(const array<_Tp, _Size>&&) _NOEXCEPT; |
Eric Fiselier | 8e706d2 | 2015-03-17 15:08:03 +0000 | [diff] [blame] | 247 | #endif |
| 248 | |
Eric Fiselier | 191f075 | 2017-04-19 01:23:39 +0000 | [diff] [blame] | 249 | #ifndef _LIBCPP_CXX03_LANG |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 250 | |
| 251 | // __tuple_types |
| 252 | |
| 253 | template <class ..._Tp> struct __tuple_types {}; |
| 254 | |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 255 | #if !__has_builtin(__type_pack_element) |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 256 | |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 257 | namespace __indexer_detail { |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 258 | |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 259 | template <size_t _Idx, class _Tp> |
| 260 | struct __indexed { using type = _Tp; }; |
| 261 | |
| 262 | template <class _Types, class _Indexes> struct __indexer; |
| 263 | |
| 264 | template <class ..._Types, size_t ..._Idx> |
| 265 | struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>> |
| 266 | : __indexed<_Idx, _Types>... |
| 267 | {}; |
| 268 | |
| 269 | template <size_t _Idx, class _Tp> |
| 270 | __indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&); |
| 271 | |
| 272 | } // namespace __indexer_detail |
| 273 | |
| 274 | template <size_t _Idx, class ..._Types> |
| 275 | using __type_pack_element = typename decltype( |
| 276 | __indexer_detail::__at_index<_Idx>( |
| 277 | __indexer_detail::__indexer< |
| 278 | __tuple_types<_Types...>, |
| 279 | typename __make_tuple_indices<sizeof...(_Types)>::type |
| 280 | >{}) |
| 281 | )::type; |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 282 | #endif |
| 283 | |
| 284 | template <size_t _Ip, class ..._Types> |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 285 | class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...>> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 286 | { |
| 287 | public: |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 288 | static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range"); |
| 289 | typedef __type_pack_element<_Ip, _Types...> type; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 290 | }; |
| 291 | |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 292 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 293 | template <class ..._Tp> |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 294 | class _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 295 | : public integral_constant<size_t, sizeof...(_Tp)> |
| 296 | { |
| 297 | }; |
| 298 | |
Howard Hinnant | f83417b | 2011-01-24 16:07:25 +0000 | [diff] [blame] | 299 | template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {}; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 300 | |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 301 | template <bool _ApplyLV, bool _ApplyConst, bool _ApplyVolatile> |
| 302 | struct __apply_cv_mf; |
| 303 | template <> |
| 304 | struct __apply_cv_mf<false, false, false> { |
| 305 | template <class _Tp> using __apply = _Tp; |
| 306 | }; |
| 307 | template <> |
| 308 | struct __apply_cv_mf<false, true, false> { |
| 309 | template <class _Tp> using __apply = const _Tp; |
| 310 | }; |
| 311 | template <> |
| 312 | struct __apply_cv_mf<false, false, true> { |
| 313 | template <class _Tp> using __apply = volatile _Tp; |
| 314 | }; |
| 315 | template <> |
| 316 | struct __apply_cv_mf<false, true, true> { |
| 317 | template <class _Tp> using __apply = const volatile _Tp; |
| 318 | }; |
| 319 | template <> |
| 320 | struct __apply_cv_mf<true, false, false> { |
| 321 | template <class _Tp> using __apply = _Tp&; |
| 322 | }; |
| 323 | template <> |
| 324 | struct __apply_cv_mf<true, true, false> { |
| 325 | template <class _Tp> using __apply = const _Tp&; |
| 326 | }; |
| 327 | template <> |
| 328 | struct __apply_cv_mf<true, false, true> { |
| 329 | template <class _Tp> using __apply = volatile _Tp&; |
| 330 | }; |
| 331 | template <> |
| 332 | struct __apply_cv_mf<true, true, true> { |
| 333 | template <class _Tp> using __apply = const volatile _Tp&; |
| 334 | }; |
| 335 | template <class _Tp, class _RawTp = typename remove_reference<_Tp>::type> |
| 336 | using __apply_cv_t = __apply_cv_mf< |
| 337 | is_lvalue_reference<_Tp>::value, |
| 338 | is_const<_RawTp>::value, |
| 339 | is_volatile<_RawTp>::value>; |
| 340 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 341 | // __make_tuple_types |
| 342 | |
Howard Hinnant | e049cc5 | 2010-09-27 17:54:17 +0000 | [diff] [blame] | 343 | // __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a |
| 344 | // __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep). |
| 345 | // _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a |
| 346 | // lvalue_reference type, then __tuple_types<_Types&...> is the result. |
| 347 | |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 348 | template <class _TupleTypes, class _TupleIndices> |
| 349 | struct __make_tuple_types_flat; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 350 | |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 351 | template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx> |
| 352 | struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> { |
| 353 | // Specialization for pair, tuple, and __tuple_types |
| 354 | template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>> |
| 355 | using __apply_quals = __tuple_types< |
| 356 | typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>... |
| 357 | >; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 358 | }; |
| 359 | |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 360 | template <class _Vt, size_t _Np, size_t ..._Idx> |
| 361 | struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> { |
Eric Fiselier | 5fb1e0a | 2016-07-02 01:25:46 +0000 | [diff] [blame] | 362 | template <size_t> |
| 363 | using __value_type = _Vt; |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 364 | template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>> |
| 365 | using __apply_quals = __tuple_types< |
Eric Fiselier | 5fb1e0a | 2016-07-02 01:25:46 +0000 | [diff] [blame] | 366 | typename _ApplyFn::template __apply<__value_type<_Idx>>... |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 367 | >; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 368 | }; |
| 369 | |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 370 | template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, |
| 371 | size_t _Sp = 0, |
| 372 | bool _SameSize = (_Ep == tuple_size<typename remove_reference<_Tp>::type>::value)> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 373 | struct __make_tuple_types |
| 374 | { |
| 375 | static_assert(_Sp <= _Ep, "__make_tuple_types input error"); |
Eric Fiselier | 053859f | 2016-07-01 03:54:54 +0000 | [diff] [blame] | 376 | using _RawTp = typename remove_cv<typename remove_reference<_Tp>::type>::type; |
| 377 | using _Maker = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>; |
| 378 | using type = typename _Maker::template __apply_quals<_Tp>; |
| 379 | }; |
| 380 | |
| 381 | template <class ..._Types, size_t _Ep> |
| 382 | struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> { |
| 383 | typedef __tuple_types<_Types...> type; |
| 384 | }; |
| 385 | |
| 386 | template <class ..._Types, size_t _Ep> |
| 387 | struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> { |
| 388 | typedef __tuple_types<_Types...> type; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 389 | }; |
| 390 | |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 391 | template <bool ..._Preds> |
| 392 | struct __all_dummy; |
| 393 | |
| 394 | template <bool ..._Pred> |
Eric Fiselier | 3ec6b84 | 2016-08-29 20:43:38 +0000 | [diff] [blame] | 395 | using __all = is_same<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>; |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 396 | |
| 397 | struct __tuple_sfinae_base { |
Eric Fiselier | 5fb1e0a | 2016-07-02 01:25:46 +0000 | [diff] [blame] | 398 | template <template <class, class...> class _Trait, |
| 399 | class ..._LArgs, class ..._RArgs> |
| 400 | static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>) |
| 401 | -> __all<typename enable_if<_Trait<_LArgs, _RArgs>::value, bool>::type{true}...>; |
| 402 | template <template <class...> class> |
| 403 | static auto __do_test(...) -> false_type; |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 404 | |
Eric Fiselier | 5fb1e0a | 2016-07-02 01:25:46 +0000 | [diff] [blame] | 405 | template <class _FromArgs, class _ToArgs> |
| 406 | using __constructible = decltype(__do_test<is_constructible>(_ToArgs{}, _FromArgs{})); |
| 407 | template <class _FromArgs, class _ToArgs> |
| 408 | using __convertible = decltype(__do_test<is_convertible>(_FromArgs{}, _ToArgs{})); |
| 409 | template <class _FromArgs, class _ToArgs> |
| 410 | using __assignable = decltype(__do_test<is_assignable>(_ToArgs{}, _FromArgs{})); |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 411 | }; |
| 412 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 413 | // __tuple_convertible |
| 414 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 415 | template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, |
| 416 | bool = __tuple_like<_Up>::value> |
| 417 | struct __tuple_convertible |
| 418 | : public false_type {}; |
| 419 | |
| 420 | template <class _Tp, class _Up> |
| 421 | struct __tuple_convertible<_Tp, _Up, true, true> |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 422 | : public __tuple_sfinae_base::__convertible< |
Eric Fiselier | 522aaf6 | 2014-10-28 06:31:22 +0000 | [diff] [blame] | 423 | typename __make_tuple_types<_Tp>::type |
| 424 | , typename __make_tuple_types<_Up>::type |
| 425 | > |
| 426 | {}; |
| 427 | |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 428 | // __tuple_constructible |
| 429 | |
Howard Hinnant | dc1345f | 2012-04-01 23:10:42 +0000 | [diff] [blame] | 430 | template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, |
| 431 | bool = __tuple_like<_Up>::value> |
| 432 | struct __tuple_constructible |
| 433 | : public false_type {}; |
| 434 | |
| 435 | template <class _Tp, class _Up> |
| 436 | struct __tuple_constructible<_Tp, _Up, true, true> |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 437 | : public __tuple_sfinae_base::__constructible< |
Eric Fiselier | 522aaf6 | 2014-10-28 06:31:22 +0000 | [diff] [blame] | 438 | typename __make_tuple_types<_Tp>::type |
| 439 | , typename __make_tuple_types<_Up>::type |
| 440 | > |
| 441 | {}; |
| 442 | |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 443 | // __tuple_assignable |
| 444 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 445 | template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, |
| 446 | bool = __tuple_like<_Up>::value> |
| 447 | struct __tuple_assignable |
| 448 | : public false_type {}; |
| 449 | |
| 450 | template <class _Tp, class _Up> |
| 451 | struct __tuple_assignable<_Tp, _Up, true, true> |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 452 | : public __tuple_sfinae_base::__assignable< |
| 453 | typename __make_tuple_types<_Tp>::type |
Eric Fiselier | 5fb1e0a | 2016-07-02 01:25:46 +0000 | [diff] [blame] | 454 | , typename __make_tuple_types<_Up&>::type |
Eric Fiselier | ed33ed8 | 2016-07-01 04:07:39 +0000 | [diff] [blame] | 455 | > |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 456 | {}; |
| 457 | |
Eric Fiselier | e1445fd | 2016-07-25 04:32:07 +0000 | [diff] [blame] | 458 | |
| 459 | template <size_t _Ip, class ..._Tp> |
Eric Fiselier | c3589a8 | 2017-01-04 23:56:00 +0000 | [diff] [blame] | 460 | class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> > |
Eric Fiselier | e1445fd | 2016-07-25 04:32:07 +0000 | [diff] [blame] | 461 | { |
| 462 | public: |
| 463 | typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type; |
| 464 | }; |
| 465 | |
| 466 | #if _LIBCPP_STD_VER > 11 |
| 467 | template <size_t _Ip, class ..._Tp> |
| 468 | using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; |
| 469 | #endif |
| 470 | |
Eric Fiselier | 9663ee4 | 2016-12-15 06:34:54 +0000 | [diff] [blame] | 471 | template <bool _IsTuple, class _SizeTrait, size_t _Expected> |
| 472 | struct __tuple_like_with_size_imp : false_type {}; |
Eric Fiselier | e1445fd | 2016-07-25 04:32:07 +0000 | [diff] [blame] | 473 | |
Eric Fiselier | 9663ee4 | 2016-12-15 06:34:54 +0000 | [diff] [blame] | 474 | template <class _SizeTrait, size_t _Expected> |
| 475 | struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected> |
| 476 | : integral_constant<bool, _SizeTrait::value == _Expected> {}; |
Eric Fiselier | e1445fd | 2016-07-25 04:32:07 +0000 | [diff] [blame] | 477 | |
Eric Fiselier | 9663ee4 | 2016-12-15 06:34:54 +0000 | [diff] [blame] | 478 | template <class _Tuple, size_t _ExpectedSize, |
| 479 | class _RawTuple = typename __uncvref<_Tuple>::type> |
| 480 | using __tuple_like_with_size = __tuple_like_with_size_imp< |
| 481 | __tuple_like<_RawTuple>::value, |
| 482 | tuple_size<_RawTuple>, _ExpectedSize |
| 483 | >; |
Eric Fiselier | e1445fd | 2016-07-25 04:32:07 +0000 | [diff] [blame] | 484 | |
| 485 | struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail { |
| 486 | template <class ...> |
| 487 | static constexpr bool __enable_default() { return false; } |
| 488 | template <class ...> |
| 489 | static constexpr bool __enable_explicit() { return false; } |
| 490 | template <class ...> |
| 491 | static constexpr bool __enable_implicit() { return false; } |
| 492 | template <class ...> |
| 493 | static constexpr bool __enable_assign() { return false; } |
| 494 | }; |
Eric Fiselier | 191f075 | 2017-04-19 01:23:39 +0000 | [diff] [blame] | 495 | #endif // !defined(_LIBCPP_CXX03_LANG) |
Eric Fiselier | e1445fd | 2016-07-25 04:32:07 +0000 | [diff] [blame] | 496 | |
Eric Fiselier | b901c34 | 2016-08-15 01:51:54 +0000 | [diff] [blame] | 497 | #if _LIBCPP_STD_VER > 14 |
| 498 | |
| 499 | template <bool _CanCopy, bool _CanMove> |
| 500 | struct __sfinae_ctor_base {}; |
| 501 | template <> |
| 502 | struct __sfinae_ctor_base<false, false> { |
| 503 | __sfinae_ctor_base() = default; |
| 504 | __sfinae_ctor_base(__sfinae_ctor_base const&) = delete; |
| 505 | __sfinae_ctor_base(__sfinae_ctor_base &&) = delete; |
| 506 | __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; |
| 507 | __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; |
| 508 | }; |
| 509 | template <> |
| 510 | struct __sfinae_ctor_base<true, false> { |
| 511 | __sfinae_ctor_base() = default; |
| 512 | __sfinae_ctor_base(__sfinae_ctor_base const&) = default; |
| 513 | __sfinae_ctor_base(__sfinae_ctor_base &&) = delete; |
| 514 | __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; |
| 515 | __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; |
| 516 | }; |
| 517 | template <> |
| 518 | struct __sfinae_ctor_base<false, true> { |
| 519 | __sfinae_ctor_base() = default; |
| 520 | __sfinae_ctor_base(__sfinae_ctor_base const&) = delete; |
| 521 | __sfinae_ctor_base(__sfinae_ctor_base &&) = default; |
| 522 | __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; |
| 523 | __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; |
| 524 | }; |
| 525 | |
| 526 | template <bool _CanCopy, bool _CanMove> |
| 527 | struct __sfinae_assign_base {}; |
| 528 | template <> |
| 529 | struct __sfinae_assign_base<false, false> { |
| 530 | __sfinae_assign_base() = default; |
| 531 | __sfinae_assign_base(__sfinae_assign_base const&) = default; |
| 532 | __sfinae_assign_base(__sfinae_assign_base &&) = default; |
| 533 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; |
| 534 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete; |
| 535 | }; |
| 536 | template <> |
| 537 | struct __sfinae_assign_base<true, false> { |
| 538 | __sfinae_assign_base() = default; |
| 539 | __sfinae_assign_base(__sfinae_assign_base const&) = default; |
| 540 | __sfinae_assign_base(__sfinae_assign_base &&) = default; |
| 541 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = default; |
| 542 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete; |
| 543 | }; |
| 544 | template <> |
| 545 | struct __sfinae_assign_base<false, true> { |
| 546 | __sfinae_assign_base() = default; |
| 547 | __sfinae_assign_base(__sfinae_assign_base const&) = default; |
| 548 | __sfinae_assign_base(__sfinae_assign_base &&) = default; |
| 549 | __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; |
| 550 | __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default; |
| 551 | }; |
| 552 | #endif // _LIBCPP_STD_VER > 14 |
| 553 | |
Eric Fiselier | 8e706d2 | 2015-03-17 15:08:03 +0000 | [diff] [blame] | 554 | _LIBCPP_END_NAMESPACE_STD |
| 555 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 556 | #endif // _LIBCPP___TUPLE |