1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4//                     The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP___TUPLE
12#define _LIBCPP___TUPLE
13
14#include <__config>
15#include <cstddef>
16#include <type_traits>
17
18#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19#pragma GCC system_header
20#endif
21
22
23_LIBCPP_BEGIN_NAMESPACE_STD
24
25template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size;
26
27#if !defined(_LIBCPP_CXX03_LANG)
28template <class _Tp, class...>
29using __enable_if_tuple_size_imp = _Tp;
30
31template <class _Tp>
32struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
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> {};
37
38template <class _Tp>
39struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
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> {};
44
45template <class _Tp>
46struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp<
47    const volatile _Tp,
48    integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
49    : public integral_constant<size_t, tuple_size<_Tp>::value> {};
50
51#else
52template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {};
53template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {};
54template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {};
55#endif
56
57template <size_t _Ip, class _Tp> class _LIBCPP_TEMPLATE_VIS tuple_element;
58
59template <size_t _Ip, class _Tp>
60class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp>
61{
62public:
63    typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
64};
65
66template <size_t _Ip, class _Tp>
67class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp>
68{
69public:
70    typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
71};
72
73template <size_t _Ip, class _Tp>
74class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp>
75{
76public:
77    typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
78};
79
80template <class _Tp> struct __tuple_like : false_type {};
81
82template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
83template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
84template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
85
86// tuple specializations
87
88#ifndef _LIBCPP_CXX03_LANG
89
90template <size_t...> struct __tuple_indices {};
91
92template <class _IdxType, _IdxType... _Values>
93struct __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)
102namespace __detail {
103
104template<typename _Tp, size_t ..._Extra> struct __repeat;
105template<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
118template<size_t _Np> struct __parity;
119template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {};
120
121template<> struct __make<0> { typedef __integer_sequence<size_t> type; };
122template<> struct __make<1> { typedef __integer_sequence<size_t, 0> type; };
123template<> struct __make<2> { typedef __integer_sequence<size_t, 0, 1> type; };
124template<> struct __make<3> { typedef __integer_sequence<size_t, 0, 1, 2> type; };
125template<> struct __make<4> { typedef __integer_sequence<size_t, 0, 1, 2, 3> type; };
126template<> struct __make<5> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4> type; };
127template<> struct __make<6> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5> type; };
128template<> struct __make<7> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5, 6> type; };
129
130template<> struct __parity<0> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type> {}; };
131template<> struct __parity<1> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 1> {}; };
132template<> struct __parity<2> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 2, _Np - 1> {}; };
133template<> struct __parity<3> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 3, _Np - 2, _Np - 1> {}; };
134template<> struct __parity<4> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
135template<> 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> {}; };
136template<> 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> {}; };
137template<> 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)
144template <size_t _Ep, size_t _Sp>
145using __make_indices_imp =
146    typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template
147    __to_tuple_indices<_Sp>;
148#else
149template <size_t _Ep, size_t _Sp>
150using __make_indices_imp =
151    typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>;
152
153#endif
154
155template <size_t _Ep, size_t _Sp = 0>
156struct __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
163template <class ..._Tp> class _LIBCPP_TEMPLATE_VIS tuple;
164
165template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
166
167template <class ..._Tp>
168struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> >
169    : public integral_constant<size_t, sizeof...(_Tp)>
170{
171};
172
173template <size_t _Ip, class ..._Tp>
174_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
175typename tuple_element<_Ip, tuple<_Tp...> >::type&
176get(tuple<_Tp...>&) _NOEXCEPT;
177
178template <size_t _Ip, class ..._Tp>
179_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
180const typename tuple_element<_Ip, tuple<_Tp...> >::type&
181get(const tuple<_Tp...>&) _NOEXCEPT;
182
183template <size_t _Ip, class ..._Tp>
184_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
185typename tuple_element<_Ip, tuple<_Tp...> >::type&&
186get(tuple<_Tp...>&&) _NOEXCEPT;
187
188template <size_t _Ip, class ..._Tp>
189_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
190const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
191get(const tuple<_Tp...>&&) _NOEXCEPT;
192
193#endif // !defined(_LIBCPP_CXX03_LANG)
194
195// pair specializations
196
197template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
198
199template <size_t _Ip, class _T1, class _T2>
200_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
201typename tuple_element<_Ip, pair<_T1, _T2> >::type&
202get(pair<_T1, _T2>&) _NOEXCEPT;
203
204template <size_t _Ip, class _T1, class _T2>
205_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
206const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
207get(const pair<_T1, _T2>&) _NOEXCEPT;
208
209#ifndef _LIBCPP_CXX03_LANG
210template <size_t _Ip, class _T1, class _T2>
211_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
212typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
213get(pair<_T1, _T2>&&) _NOEXCEPT;
214
215template <size_t _Ip, class _T1, class _T2>
216_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
217const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
218get(const pair<_T1, _T2>&&) _NOEXCEPT;
219#endif
220
221// array specializations
222
223template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
224
225template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
226
227template <size_t _Ip, class _Tp, size_t _Size>
228_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
229_Tp&
230get(array<_Tp, _Size>&) _NOEXCEPT;
231
232template <size_t _Ip, class _Tp, size_t _Size>
233_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
234const _Tp&
235get(const array<_Tp, _Size>&) _NOEXCEPT;
236
237#ifndef _LIBCPP_CXX03_LANG
238template <size_t _Ip, class _Tp, size_t _Size>
239_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
240_Tp&&
241get(array<_Tp, _Size>&&) _NOEXCEPT;
242
243template <size_t _Ip, class _Tp, size_t _Size>
244_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
245const _Tp&&
246get(const array<_Tp, _Size>&&) _NOEXCEPT;
247#endif
248
249#ifndef _LIBCPP_CXX03_LANG
250
251// __tuple_types
252
253template <class ..._Tp> struct __tuple_types {};
254
255#if !__has_builtin(__type_pack_element)
256
257namespace __indexer_detail {
258
259template <size_t _Idx, class _Tp>
260struct __indexed { using type = _Tp; };
261
262template <class _Types, class _Indexes> struct __indexer;
263
264template <class ..._Types, size_t ..._Idx>
265struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>>
266    : __indexed<_Idx, _Types>...
267{};
268
269template <size_t _Idx, class _Tp>
270__indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&);
271
272} // namespace __indexer_detail
273
274template <size_t _Idx, class ..._Types>
275using __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;
282#endif
283
284template <size_t _Ip, class ..._Types>
285class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...>>
286{
287public:
288    static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
289    typedef __type_pack_element<_Ip, _Types...> type;
290};
291
292
293template <class ..._Tp>
294struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> >
295    : public integral_constant<size_t, sizeof...(_Tp)>
296{
297};
298
299template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
300
301template <bool _ApplyLV, bool _ApplyConst, bool _ApplyVolatile>
302struct __apply_cv_mf;
303template <>
304struct __apply_cv_mf<false, false, false> {
305  template <class _Tp> using __apply = _Tp;
306};
307template <>
308struct __apply_cv_mf<false, true, false> {
309  template <class _Tp> using __apply = const _Tp;
310};
311template <>
312struct __apply_cv_mf<false, false, true> {
313  template <class _Tp> using __apply = volatile _Tp;
314};
315template <>
316struct __apply_cv_mf<false, true, true> {
317  template <class _Tp> using __apply = const volatile _Tp;
318};
319template <>
320struct __apply_cv_mf<true, false, false> {
321  template <class _Tp> using __apply = _Tp&;
322};
323template <>
324struct __apply_cv_mf<true, true, false> {
325  template <class _Tp> using __apply = const _Tp&;
326};
327template <>
328struct __apply_cv_mf<true, false, true> {
329  template <class _Tp> using __apply = volatile _Tp&;
330};
331template <>
332struct __apply_cv_mf<true, true, true> {
333  template <class _Tp> using __apply = const volatile _Tp&;
334};
335template <class _Tp, class _RawTp = typename remove_reference<_Tp>::type>
336using __apply_cv_t = __apply_cv_mf<
337    is_lvalue_reference<_Tp>::value,
338    is_const<_RawTp>::value,
339    is_volatile<_RawTp>::value>;
340
341// __make_tuple_types
342
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
348template <class _TupleTypes, class _TupleIndices>
349struct __make_tuple_types_flat;
350
351template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx>
352struct __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    >;
358};
359
360template <class _Vt, size_t _Np, size_t ..._Idx>
361struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> {
362  template <size_t>
363  using __value_type = _Vt;
364  template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>>
365  using __apply_quals = __tuple_types<
366      typename _ApplyFn::template __apply<__value_type<_Idx>>...
367    >;
368};
369
370template <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)>
373struct __make_tuple_types
374{
375    static_assert(_Sp <= _Ep, "__make_tuple_types input error");
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
381template <class ..._Types, size_t _Ep>
382struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> {
383  typedef __tuple_types<_Types...> type;
384};
385
386template <class ..._Types, size_t _Ep>
387struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> {
388  typedef __tuple_types<_Types...> type;
389};
390
391template <bool ..._Preds>
392struct __all_dummy;
393
394template <bool ..._Pred>
395using __all = is_same<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>;
396
397struct __tuple_sfinae_base {
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;
404
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{}));
411};
412
413// __tuple_convertible
414
415template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
416                                bool = __tuple_like<_Up>::value>
417struct __tuple_convertible
418    : public false_type {};
419
420template <class _Tp, class _Up>
421struct __tuple_convertible<_Tp, _Up, true, true>
422    : public __tuple_sfinae_base::__convertible<
423      typename __make_tuple_types<_Tp>::type
424    , typename __make_tuple_types<_Up>::type
425    >
426{};
427
428// __tuple_constructible
429
430template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
431                                bool = __tuple_like<_Up>::value>
432struct __tuple_constructible
433    : public false_type {};
434
435template <class _Tp, class _Up>
436struct __tuple_constructible<_Tp, _Up, true, true>
437    : public __tuple_sfinae_base::__constructible<
438      typename __make_tuple_types<_Tp>::type
439    , typename __make_tuple_types<_Up>::type
440    >
441{};
442
443// __tuple_assignable
444
445template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
446                                bool = __tuple_like<_Up>::value>
447struct __tuple_assignable
448    : public false_type {};
449
450template <class _Tp, class _Up>
451struct __tuple_assignable<_Tp, _Up, true, true>
452    : public __tuple_sfinae_base::__assignable<
453      typename __make_tuple_types<_Tp>::type
454    , typename __make_tuple_types<_Up&>::type
455    >
456{};
457
458
459template <size_t _Ip, class ..._Tp>
460class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> >
461{
462public:
463    typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
464};
465
466#if _LIBCPP_STD_VER > 11
467template <size_t _Ip, class ..._Tp>
468using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type;
469#endif
470
471template <bool _IsTuple, class _SizeTrait, size_t _Expected>
472struct __tuple_like_with_size_imp : false_type {};
473
474template <class _SizeTrait, size_t _Expected>
475struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected>
476    : integral_constant<bool, _SizeTrait::value == _Expected> {};
477
478template <class _Tuple, size_t _ExpectedSize,
479          class _RawTuple = typename __uncvref<_Tuple>::type>
480using __tuple_like_with_size = __tuple_like_with_size_imp<
481                                   __tuple_like<_RawTuple>::value,
482                                   tuple_size<_RawTuple>, _ExpectedSize
483                              >;
484
485struct _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};
495#endif // !defined(_LIBCPP_CXX03_LANG)
496
497#if _LIBCPP_STD_VER > 14
498
499template <bool _CanCopy, bool _CanMove>
500struct __sfinae_ctor_base {};
501template <>
502struct __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};
509template <>
510struct __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};
517template <>
518struct __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
526template <bool _CanCopy, bool _CanMove>
527struct __sfinae_assign_base {};
528template <>
529struct __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};
536template <>
537struct __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};
544template <>
545struct __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
554_LIBCPP_END_NAMESPACE_STD
555
556#endif  // _LIBCPP___TUPLE
557