@@ -427,6 +427,93 @@ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;
427
427
template <class _Tp > class _LIBCPP_TEMPLATE_VIS reference_wrapper;
428
428
template <class _Tp > struct _LIBCPP_TEMPLATE_VIS hash;
429
429
430
+
431
+ template <class _Tp , _Tp __v>
432
+ struct _LIBCPP_TEMPLATE_VIS integral_constant
433
+ {
434
+ static _LIBCPP_CONSTEXPR const _Tp value = __v;
435
+ typedef _Tp value_type;
436
+ typedef integral_constant type;
437
+ _LIBCPP_INLINE_VISIBILITY
438
+ _LIBCPP_CONSTEXPR operator value_type () const _NOEXCEPT {return value;}
439
+ #if _LIBCPP_STD_VER > 11
440
+ _LIBCPP_INLINE_VISIBILITY
441
+ constexpr value_type operator ()() const _NOEXCEPT {return value;}
442
+ #endif
443
+ };
444
+
445
+ template <class _Tp , _Tp __v>
446
+ _LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
447
+
448
+ #if _LIBCPP_STD_VER > 14
449
+ template <bool __b>
450
+ using bool_constant = integral_constant<bool , __b>;
451
+ #define _LIBCPP_BOOL_CONSTANT (__b ) bool_constant<(__b)>
452
+ #else
453
+ #define _LIBCPP_BOOL_CONSTANT (__b ) integral_constant<bool ,(__b)>
454
+ #endif
455
+
456
+ typedef _LIBCPP_BOOL_CONSTANT (true ) true_type;
457
+ typedef _LIBCPP_BOOL_CONSTANT (false ) false_type;
458
+
459
+ template <bool _Val>
460
+ using _BoolConstant _LIBCPP_NODEBUG_TYPE = integral_constant<bool , _Val>;
461
+
462
+ template <bool > struct _MetaBase ;
463
+ template <>
464
+ struct _MetaBase <true > {
465
+ template <class _Tp , class _Up >
466
+ using _SelectImpl _LIBCPP_NODEBUG_TYPE = _Tp;
467
+ template <template <class ...> class _FirstFn , template <class ...> class , class ..._Args>
468
+ using _SelectApplyImpl _LIBCPP_NODEBUG_TYPE = _FirstFn<_Args...>;
469
+ template <class _First , class ...>
470
+ using _FirstImpl _LIBCPP_NODEBUG_TYPE = _First;
471
+ template <class , class _Second , class ...>
472
+ using _SecondImpl _LIBCPP_NODEBUG_TYPE = _Second;
473
+ template <class _Tp = void >
474
+ using _EnableIfImpl _LIBCPP_NODEBUG_TYPE = _Tp;
475
+ template <class _Result , class _First , class ..._Rest>
476
+ using _OrImpl _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_First::type::value != true && sizeof ...(_Rest) != 0 >::template _OrImpl<_First, _Rest...>;
477
+ template <class _Result , class _First , class ..._Rest>
478
+ using _AndImpl _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_First::type::value == true && sizeof ...(_Rest) != 0 >::template _AndImpl<_First, _Rest...>;
479
+ };
480
+
481
+ template <>
482
+ struct _MetaBase <false > {
483
+ template <class _Tp , class _Up >
484
+ using _SelectImpl _LIBCPP_NODEBUG_TYPE = _Up;
485
+ template <template <class ...> class , template <class ...> class _SecondFn , class ..._Args>
486
+ using _SelectApplyImpl _LIBCPP_NODEBUG_TYPE = _SecondFn<_Args...>;
487
+ template <class _Result , class ...>
488
+ using _OrImpl _LIBCPP_NODEBUG_TYPE = _Result;
489
+ template <class _Result , class ...>
490
+ using _AndImpl _LIBCPP_NODEBUG_TYPE = _Result;
491
+ };
492
+ template <bool _Cond, class _Ret = void >
493
+ using _EnableIf _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_Cond>::template _EnableIfImpl<_Ret>;
494
+ template <bool _Cond, class _IfRes , class _ElseRes >
495
+ using _If _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>;
496
+ template <class ..._Rest>
497
+ using _Or _LIBCPP_NODEBUG_TYPE = typename _MetaBase< sizeof ...(_Rest) != 0 >::template _OrImpl<false_type, _Rest...>;
498
+ template <class ..._Rest>
499
+ using _And _LIBCPP_NODEBUG_TYPE = typename _MetaBase< sizeof ...(_Rest) != 0 >::template _AndImpl<true_type, _Rest...>;
500
+ template <class _Pred >
501
+ struct _Not : _BoolConstant<!_Pred::type::value> {};
502
+ template <class ..._Args>
503
+ using _FirstType _LIBCPP_NODEBUG_TYPE = typename _MetaBase<(sizeof ...(_Args) >= 1 )>::template _FirstImpl<_Args...>;
504
+ template <class ..._Args>
505
+ using _SecondType _LIBCPP_NODEBUG_TYPE = typename _MetaBase<(sizeof ...(_Args) >= 2 )>::template _SecondImpl<_Args...>;
506
+
507
+ // Member detector base
508
+
509
+ template <template <class ...> class _Templ , class ..._Args>
510
+ true_type __sfinae_test_impl (_FirstType<int , _Templ<_Args...> >);
511
+ template <template <class ...> class , class ...>
512
+ false_type __sfinae_test_impl (...);
513
+
514
+ template <template <class ...> class _Templ , class ..._Args>
515
+ using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype (std::__sfinae_test_impl<_Templ, _Args...>(0 ));
516
+
430
517
template <class >
431
518
struct __void_t { typedef void type; };
432
519
@@ -528,34 +615,6 @@ struct __two {char __lx[2];};
528
615
529
616
// helper class:
530
617
531
- template <class _Tp , _Tp __v>
532
- struct _LIBCPP_TEMPLATE_VIS integral_constant
533
- {
534
- static _LIBCPP_CONSTEXPR const _Tp value = __v;
535
- typedef _Tp value_type;
536
- typedef integral_constant type;
537
- _LIBCPP_INLINE_VISIBILITY
538
- _LIBCPP_CONSTEXPR operator value_type () const _NOEXCEPT {return value;}
539
- #if _LIBCPP_STD_VER > 11
540
- _LIBCPP_INLINE_VISIBILITY
541
- constexpr value_type operator ()() const _NOEXCEPT {return value;}
542
- #endif
543
- };
544
-
545
- template <class _Tp , _Tp __v>
546
- _LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
547
-
548
- #if _LIBCPP_STD_VER > 14
549
- template <bool __b>
550
- using bool_constant = integral_constant<bool , __b>;
551
- #define _LIBCPP_BOOL_CONSTANT (__b ) bool_constant<(__b)>
552
- #else
553
- #define _LIBCPP_BOOL_CONSTANT (__b ) integral_constant<bool ,(__b)>
554
- #endif
555
-
556
- typedef _LIBCPP_BOOL_CONSTANT (true ) true_type;
557
- typedef _LIBCPP_BOOL_CONSTANT (false ) false_type;
558
-
559
618
#if !defined(_LIBCPP_CXX03_LANG)
560
619
561
620
// __lazy_and
0 commit comments