diff options
Diffstat (limited to 'libcxx/include/type_traits')
| -rw-r--r-- | libcxx/include/type_traits | 914 |
1 files changed, 299 insertions, 615 deletions
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index b15c7a2a5f35..e9d5e06f36dc 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -1,5 +1,5 @@ // -*- C++ -*- -//===------------------------ type_traits ---------------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -455,58 +455,63 @@ using bool_constant = integral_constant<bool, __b>; #define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)> #endif +template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;}; + +template <bool _Bp, class _Tp = void> using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type; + +#if _LIBCPP_STD_VER > 11 +template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; +#endif + typedef _LIBCPP_BOOL_CONSTANT(true) true_type; typedef _LIBCPP_BOOL_CONSTANT(false) false_type; template <bool _Val> -using _BoolConstant _LIBCPP_NODEBUG_TYPE = integral_constant<bool, _Val>; +using _BoolConstant _LIBCPP_NODEBUG = integral_constant<bool, _Val>; template <bool> struct _MetaBase; template <> struct _MetaBase<true> { template <class _Tp, class _Up> - using _SelectImpl _LIBCPP_NODEBUG_TYPE = _Tp; + using _SelectImpl _LIBCPP_NODEBUG = _Tp; template <template <class...> class _FirstFn, template <class...> class, class ..._Args> - using _SelectApplyImpl _LIBCPP_NODEBUG_TYPE = _FirstFn<_Args...>; + using _SelectApplyImpl _LIBCPP_NODEBUG = _FirstFn<_Args...>; template <class _First, class...> - using _FirstImpl _LIBCPP_NODEBUG_TYPE = _First; + using _FirstImpl _LIBCPP_NODEBUG = _First; template <class, class _Second, class...> - using _SecondImpl _LIBCPP_NODEBUG_TYPE = _Second; - template <class _Tp = void> - using _EnableIfImpl _LIBCPP_NODEBUG_TYPE = _Tp; + using _SecondImpl _LIBCPP_NODEBUG = _Second; template <class _Result, class _First, class ..._Rest> - using _OrImpl _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_First::value != true && sizeof...(_Rest) != 0>::template _OrImpl<_First, _Rest...>; + using _OrImpl _LIBCPP_NODEBUG = typename _MetaBase<_First::value != true && sizeof...(_Rest) != 0>::template _OrImpl<_First, _Rest...>; }; template <> struct _MetaBase<false> { template <class _Tp, class _Up> - using _SelectImpl _LIBCPP_NODEBUG_TYPE = _Up; + using _SelectImpl _LIBCPP_NODEBUG = _Up; template <template <class...> class, template <class...> class _SecondFn, class ..._Args> - using _SelectApplyImpl _LIBCPP_NODEBUG_TYPE = _SecondFn<_Args...>; + using _SelectApplyImpl _LIBCPP_NODEBUG = _SecondFn<_Args...>; template <class _Result, class ...> - using _OrImpl _LIBCPP_NODEBUG_TYPE = _Result; + using _OrImpl _LIBCPP_NODEBUG = _Result; }; -template <bool _Cond, class _Ret = void> -using _EnableIf _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_Cond>::template _EnableIfImpl<_Ret>; template <bool _Cond, class _IfRes, class _ElseRes> -using _If _LIBCPP_NODEBUG_TYPE = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>; +using _If _LIBCPP_NODEBUG = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>; template <class ..._Rest> -using _Or _LIBCPP_NODEBUG_TYPE = typename _MetaBase< sizeof...(_Rest) != 0 >::template _OrImpl<false_type, _Rest...>; +using _Or _LIBCPP_NODEBUG = typename _MetaBase< sizeof...(_Rest) != 0 >::template _OrImpl<false_type, _Rest...>; template <class _Pred> struct _Not : _BoolConstant<!_Pred::value> {}; template <class ..._Args> -using _FirstType _LIBCPP_NODEBUG_TYPE = typename _MetaBase<(sizeof...(_Args) >= 1)>::template _FirstImpl<_Args...>; +using _FirstType _LIBCPP_NODEBUG = typename _MetaBase<(sizeof...(_Args) >= 1)>::template _FirstImpl<_Args...>; template <class ..._Args> -using _SecondType _LIBCPP_NODEBUG_TYPE = typename _MetaBase<(sizeof...(_Args) >= 2)>::template _SecondImpl<_Args...>; +using _SecondType _LIBCPP_NODEBUG = typename _MetaBase<(sizeof...(_Args) >= 2)>::template _SecondImpl<_Args...>; template <class ...> using __expand_to_true = true_type; template <class ..._Pred> -__expand_to_true<_EnableIf<_Pred::value>...> __and_helper(int); +__expand_to_true<__enable_if_t<_Pred::value>...> __and_helper(int); template <class ...> false_type __and_helper(...); template <class ..._Pred> -using _And _LIBCPP_NODEBUG_TYPE = decltype(__and_helper<_Pred...>(0)); +using _And _LIBCPP_NODEBUG = decltype(__and_helper<_Pred...>(0)); template <template <class...> class _Func, class ..._Args> struct _Lazy : _Func<_Args...> {}; @@ -519,7 +524,7 @@ template <template <class...> class, class ...> false_type __sfinae_test_impl(...); template <template <class ...> class _Templ, class ..._Args> -using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype(__sfinae_test_impl<_Templ, _Args...>(0)); +using _IsValidExpansion _LIBCPP_NODEBUG = decltype(__sfinae_test_impl<_Templ, _Args...>(0)); template <class> struct __void_t { typedef void type; }; @@ -528,7 +533,7 @@ template <class _Tp> struct __identity { typedef _Tp type; }; template <class _Tp> -using __identity_t _LIBCPP_NODEBUG_TYPE = typename __identity<_Tp>::type; +using __identity_t _LIBCPP_NODEBUG = typename __identity<_Tp>::type; template <class _Tp, bool> struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {}; @@ -543,13 +548,6 @@ template <class _If, class _Then> template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type; #endif -template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;}; - -#if _LIBCPP_STD_VER > 11 -template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; -#endif - // is_same #if __has_keyword(__is_same) @@ -557,9 +555,9 @@ template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, class _Up> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_same_v = __is_same(_Tp, _Up); +inline constexpr bool is_same_v = __is_same(_Tp, _Up); #endif #else @@ -567,10 +565,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_same_v = __is_same(_Tp, _Up); template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, class _Up> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_same_v - = is_same<_Tp, _Up>::value; +inline constexpr bool is_same_v = is_same<_Tp, _Up>::value; #endif #endif // __is_same @@ -595,7 +592,7 @@ using _IsNotSame = _BoolConstant< template <class _Tp> -using __test_for_primary_template = _EnableIf< +using __test_for_primary_template = __enable_if_t< _IsSame<_Tp, typename _Tp::__primary_template>::value >; template <class _Tp> @@ -614,9 +611,9 @@ struct __two {char __lx[2];}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_const_v = __is_const(_Tp); +inline constexpr bool is_const_v = __is_const(_Tp); #endif #else @@ -624,10 +621,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_const_v = __is_const(_Tp); template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_const_v - = is_const<_Tp>::value; +inline constexpr bool is_const_v = is_const<_Tp>::value; #endif #endif // __has_keyword(__is_const) @@ -639,9 +635,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_const_v template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_volatile_v = __is_volatile(_Tp); +inline constexpr bool is_volatile_v = __is_volatile(_Tp); #endif #else @@ -649,10 +645,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_volatile_v = __is_volatile(_Tp); template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile : public false_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile<_Tp volatile> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_volatile_v - = is_volatile<_Tp>::value; +inline constexpr bool is_volatile_v = is_volatile<_Tp>::value; #endif #endif // __has_keyword(__is_volatile) @@ -727,9 +722,9 @@ template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_void_v = __is_void(_Tp); +inline constexpr bool is_void_v = __is_void(_Tp); #endif #else @@ -737,10 +732,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_void_v = __is_void(_Tp); template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_void : public is_same<typename remove_cv<_Tp>::type, void> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_void_v - = is_void<_Tp>::value; +inline constexpr bool is_void_v = is_void<_Tp>::value; #endif #endif // __has_keyword(__is_void) @@ -757,10 +751,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_null_pointer : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_null_pointer_v - = is_null_pointer<_Tp>::value; +inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; #endif #endif // _LIBCPP_STD_VER > 11 @@ -773,7 +766,7 @@ struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> { }; #if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_integral_v = __is_integral(_Tp); +inline constexpr bool is_integral_v = __is_integral(_Tp); #endif #else @@ -781,16 +774,13 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_integral_v = __is_integral(_Tp); template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_integral : public _BoolConstant<__libcpp_is_integral<typename remove_cv<_Tp>::type>::value> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_integral_v - = is_integral<_Tp>::value; +inline constexpr bool is_integral_v = is_integral<_Tp>::value; #endif #endif // __has_keyword(__is_integral) -// __libcpp_is_signed_integer, __libcpp_is_unsigned_integer - // [basic.fundamental] defines five standard signed integer types; // __int128_t is an extended signed integer type. // The signed and unsigned integer types, plus bool and the @@ -817,6 +807,7 @@ template <> struct __libcpp_is_unsigned_integer<__uint128_t> : public tru #endif // is_floating_point +// <concepts> implements __libcpp_floating_point template <class _Tp> struct __libcpp_is_floating_point : public false_type {}; template <> struct __libcpp_is_floating_point<float> : public true_type {}; @@ -826,10 +817,9 @@ template <> struct __libcpp_is_floating_point<long double> : public tru template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_floating_point : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_floating_point_v - = is_floating_point<_Tp>::value; +inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; #endif // is_array @@ -839,9 +829,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_floating_point_v template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_array_v = __is_array(_Tp); +inline constexpr bool is_array_v = __is_array(_Tp); #endif #else @@ -853,27 +843,25 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[]> template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_array_v - = is_array<_Tp>::value; +inline constexpr bool is_array_v = is_array<_Tp>::value; #endif #endif // __has_keyword(__is_array) // is_pointer -// Before Clang 11 / AppleClang 12.0.5, __is_pointer didn't work for Objective-C types. +// Before AppleClang 12.0.5, __is_pointer didn't work for Objective-C types. #if __has_keyword(__is_pointer) && \ - !(defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1100) && \ !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1205) template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_pointer_v = __is_pointer(_Tp); +inline constexpr bool is_pointer_v = __is_pointer(_Tp); #endif #else // __has_keyword(__is_pointer) @@ -892,10 +880,9 @@ template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretai template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer : public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<typename remove_cv<_Tp>::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_pointer_v - = is_pointer<_Tp>::value; +inline constexpr bool is_pointer_v = is_pointer<_Tp>::value; #endif #endif // __has_keyword(__is_pointer) @@ -915,15 +902,13 @@ struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_refe template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_reference_v = __is_reference(_Tp); - +inline constexpr bool is_reference_v = __is_reference(_Tp); template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_lvalue_reference_v = __is_lvalue_reference(_Tp); - +inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp); template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_rvalue_reference_v = __is_rvalue_reference(_Tp); +inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp); #endif #else // __has_keyword(__is_lvalue_reference) && etc... @@ -938,18 +923,15 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public fa template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_reference_v - = is_reference<_Tp>::value; +inline constexpr bool is_reference_v = is_reference<_Tp>::value; template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_lvalue_reference_v - = is_lvalue_reference<_Tp>::value; +inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value; template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_rvalue_reference_v - = is_rvalue_reference<_Tp>::value; +inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value; #endif #endif // __has_keyword(__is_lvalue_reference) && etc... @@ -969,10 +951,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_union_v - = is_union<_Tp>::value; +inline constexpr bool is_union_v = is_union<_Tp>::value; #endif // is_class @@ -995,10 +976,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_class_v - = is_class<_Tp>::value; +inline constexpr bool is_class_v = is_class<_Tp>::value; #endif // is_function @@ -1013,10 +993,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_function_v - = is_function<_Tp>::value; +inline constexpr bool is_function_v = is_function<_Tp>::value; #endif template <class _Tp> struct __libcpp_is_member_pointer { @@ -1040,10 +1019,9 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_function_pointer_v - = __is_member_function_pointer(_Tp); +inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); #endif #else // __has_keyword(__is_member_function_pointer) @@ -1051,10 +1029,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_function_pointer_v template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_func > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_function_pointer_v - = is_member_function_pointer<_Tp>::value; +inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value; #endif #endif // __has_keyword(__is_member_function_pointer) @@ -1066,9 +1043,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_function_pointer_v template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_pointer_v = __is_member_pointer(_Tp); +inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); #endif #else // __has_keyword(__is_member_pointer) @@ -1076,10 +1053,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_pointer_v = __is_member_poin template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_member > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_pointer_v - = is_member_pointer<_Tp>::value; +inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; #endif #endif // __has_keyword(__is_member_pointer) @@ -1092,10 +1068,9 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_object_pointer_v - = __is_member_object_pointer(_Tp); +inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); #endif #else // __has_keyword(__is_member_object_pointer) @@ -1103,10 +1078,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_object_pointer_v template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_obj > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_object_pointer_v - = is_member_object_pointer<_Tp>::value; +inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value; #endif #endif // __has_keyword(__is_member_object_pointer) @@ -1118,9 +1092,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_object_pointer_v template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum : public integral_constant<bool, __is_enum(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_enum_v = __is_enum(_Tp); +inline constexpr bool is_enum_v = __is_enum(_Tp); #endif #else @@ -1137,10 +1111,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum !is_class<_Tp>::value && !is_function<_Tp>::value > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_enum_v - = is_enum<_Tp>::value; +inline constexpr bool is_enum_v = is_enum<_Tp>::value; #endif #endif // __has_feature(is_enum) || defined(_LIBCPP_COMPILER_GCC) @@ -1152,10 +1125,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_arithmetic : public integral_constant<bool, is_integral<_Tp>::value || is_floating_point<_Tp>::value> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_arithmetic_v - = is_arithmetic<_Tp>::value; +inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; #endif // is_fundamental @@ -1169,9 +1141,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_arithmetic_v template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_fundamental_v = __is_fundamental(_Tp); +inline constexpr bool is_fundamental_v = __is_fundamental(_Tp); #endif #else // __has_keyword(__is_fundamental) @@ -1181,10 +1153,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_fundamental __is_nullptr_t<_Tp>::value || is_arithmetic<_Tp>::value> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_fundamental_v - = is_fundamental<_Tp>::value; +inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; #endif #endif // __has_keyword(__is_fundamental) @@ -1197,9 +1168,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_fundamental_v template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_scalar_v = __is_scalar(_Tp); +inline constexpr bool is_scalar_v = __is_scalar(_Tp); #endif #else // __has_keyword(__is_scalar) @@ -1219,10 +1190,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_scalar template <> struct _LIBCPP_TEMPLATE_VIS is_scalar<nullptr_t> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_scalar_v - = is_scalar<_Tp>::value; +inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; #endif #endif // __has_keyword(__is_scalar) @@ -1234,9 +1204,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_scalar_v template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_object_v = __is_object(_Tp); +inline constexpr bool is_object_v = __is_object(_Tp); #endif #else // __has_keyword(__is_object) @@ -1247,10 +1217,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_object is_union<_Tp>::value || is_class<_Tp>::value > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_object_v - = is_object<_Tp>::value; +inline constexpr bool is_object_v = is_object<_Tp>::value; #endif #endif // __has_keyword(__is_object) @@ -1263,9 +1232,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_object_v template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_compound_v = __is_compound(_Tp); +inline constexpr bool is_compound_v = __is_compound(_Tp); #endif #else // __has_keyword(__is_compound) @@ -1273,10 +1242,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_compound_v = __is_compound(_Tp); template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_compound : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_compound_v - = is_compound<_Tp>::value; +inline constexpr bool is_compound_v = is_compound<_Tp>::value; #endif #endif // __has_keyword(__is_compound) @@ -1296,7 +1264,7 @@ struct __is_referenceable : integral_constant<bool, // add_const template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const { - typedef _LIBCPP_NODEBUG_TYPE const _Tp type; + typedef _LIBCPP_NODEBUG const _Tp type; }; #if _LIBCPP_STD_VER > 11 @@ -1306,7 +1274,7 @@ template <class _Tp> using add_const_t = typename add_const<_Tp>::type; // add_volatile template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile { - typedef _LIBCPP_NODEBUG_TYPE volatile _Tp type; + typedef _LIBCPP_NODEBUG volatile _Tp type; }; #if _LIBCPP_STD_VER > 11 @@ -1315,7 +1283,7 @@ template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; // add_cv template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv { - typedef _LIBCPP_NODEBUG_TYPE const volatile _Tp type; + typedef _LIBCPP_NODEBUG const volatile _Tp type; }; #if _LIBCPP_STD_VER > 11 @@ -1331,9 +1299,9 @@ struct _LIBCPP_TEMPLATE_VIS remove_reference { typedef __remove_reference(_Tp) t #else // __has_keyword(__remove_reference) -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG _Tp type;}; #if _LIBCPP_STD_VER > 11 template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; @@ -1343,21 +1311,21 @@ template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>:: // add_lvalue_reference -template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _LIBCPP_NODEBUG_TYPE _Tp type; }; -template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG_TYPE _Tp& type; }; +template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef _LIBCPP_NODEBUG _Tp type; }; +template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG _Tp& type; }; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_lvalue_reference -{typedef _LIBCPP_NODEBUG_TYPE typename __add_lvalue_reference_impl<_Tp>::type type;}; +{typedef _LIBCPP_NODEBUG typename __add_lvalue_reference_impl<_Tp>::type type;}; #if _LIBCPP_STD_VER > 11 template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; #endif -template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _LIBCPP_NODEBUG_TYPE _Tp type; }; -template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG_TYPE _Tp&& type; }; +template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _LIBCPP_NODEBUG _Tp type; }; +template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG _Tp&& type; }; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference -{typedef _LIBCPP_NODEBUG_TYPE typename __add_rvalue_reference_impl<_Tp>::type type;}; +{typedef _LIBCPP_NODEBUG typename __add_rvalue_reference_impl<_Tp>::type type;}; #if _LIBCPP_STD_VER > 11 template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; @@ -1378,17 +1346,17 @@ declval() _NOEXCEPT; template <class _Tp> struct __uncvref { - typedef _LIBCPP_NODEBUG_TYPE typename remove_cv<typename remove_reference<_Tp>::type>::type type; + typedef _LIBCPP_NODEBUG typename remove_cv<typename remove_reference<_Tp>::type>::type type; }; template <class _Tp> struct __unconstref { - typedef _LIBCPP_NODEBUG_TYPE typename remove_const<typename remove_reference<_Tp>::type>::type type; + typedef _LIBCPP_NODEBUG typename remove_const<typename remove_reference<_Tp>::type>::type type; }; #ifndef _LIBCPP_CXX03_LANG template <class _Tp> -using __uncvref_t _LIBCPP_NODEBUG_TYPE = typename __uncvref<_Tp>::type; +using __uncvref_t _LIBCPP_NODEBUG = typename __uncvref<_Tp>::type; #endif // __is_same_uncvref @@ -1413,11 +1381,11 @@ struct __any // remove_pointer -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*> {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _LIBCPP_NODEBUG _Tp type;}; +template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG _Tp type;}; #if _LIBCPP_STD_VER > 11 template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type; @@ -1429,12 +1397,12 @@ template <class _Tp, bool = __is_referenceable<_Tp>::value || _IsSame<typename remove_cv<_Tp>::type, void>::value> struct __add_pointer_impl - {typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tp>::type* type;}; + {typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type* type;}; template <class _Tp> struct __add_pointer_impl<_Tp, false> - {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; + {typedef _LIBCPP_NODEBUG _Tp type;}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_pointer - {typedef _LIBCPP_NODEBUG_TYPE typename __add_pointer_impl<_Tp>::type type;}; + {typedef _LIBCPP_NODEBUG typename __add_pointer_impl<_Tp>::type type;}; #if _LIBCPP_STD_VER > 11 template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; @@ -1455,9 +1423,9 @@ template<class _Tp> using type_identity_t = typename type_identity<_Tp>::type; template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_signed_v = __is_signed(_Tp); +inline constexpr bool is_signed_v = __is_signed(_Tp); #endif #else // __has_keyword(__is_signed) @@ -1475,10 +1443,9 @@ template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type { template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_signed : public __libcpp_is_signed<_Tp> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_signed_v - = is_signed<_Tp>::value; +inline constexpr bool is_signed_v = is_signed<_Tp>::value; #endif #endif // __has_keyword(__is_signed) @@ -1494,9 +1461,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_signed_v template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_unsigned_v = __is_unsigned(_Tp); +inline constexpr bool is_unsigned_v = __is_unsigned(_Tp); #endif #else // __has_keyword(__is_unsigned) @@ -1514,10 +1481,9 @@ template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unsigned : public __libcpp_is_unsigned<_Tp> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_unsigned_v - = is_unsigned<_Tp>::value; +inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value; #endif #endif // __has_keyword(__is_unsigned) @@ -1531,10 +1497,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]> template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]> : public integral_constant<size_t, rank<_Tp>::value + 1> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR size_t rank_v - = rank<_Tp>::value; +inline constexpr size_t rank_v = rank<_Tp>::value; #endif // extent @@ -1545,9 +1510,9 @@ template<class _Tp, size_t _Dim = 0> struct _LIBCPP_TEMPLATE_VIS extent : integral_constant<size_t, __array_extent(_Tp, _Dim)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, unsigned _Ip = 0> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR size_t extent_v = __array_extent(_Tp, _Ip); +inline constexpr size_t extent_v = __array_extent(_Tp, _Ip); #endif #else // __has_keyword(__array_extent) @@ -1563,10 +1528,9 @@ template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], 0> template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], _Ip> : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, unsigned _Ip = 0> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR size_t extent_v - = extent<_Tp, _Ip>::value; +inline constexpr size_t extent_v = extent<_Tp, _Ip>::value; #endif #endif // __has_keyword(__array_extent) @@ -1604,7 +1568,7 @@ template <class> struct _LIBCPP_TEMPLATE_VIS is_bounded_array template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_bounded_array<_Tp[_Np]> : true_type {}; template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR +inline constexpr bool is_bounded_array_v = is_bounded_array<_Tp>::value; // is_unbounded_array @@ -1613,7 +1577,7 @@ template <class> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array : fal template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array<_Tp[]> : true_type {}; template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR +inline constexpr bool is_unbounded_array_v = is_unbounded_array<_Tp>::value; #endif @@ -1621,13 +1585,13 @@ bool is_unbounded_array_v = is_unbounded_array<_Tp>::value; template <class _Up, bool> struct __decay { - typedef _LIBCPP_NODEBUG_TYPE typename remove_cv<_Up>::type type; + typedef _LIBCPP_NODEBUG typename remove_cv<_Up>::type type; }; template <class _Up> struct __decay<_Up, true> { public: - typedef _LIBCPP_NODEBUG_TYPE typename conditional + typedef _LIBCPP_NODEBUG typename conditional < is_array<_Up>::value, typename remove_extent<_Up>::type*, @@ -1644,9 +1608,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS decay { private: - typedef _LIBCPP_NODEBUG_TYPE typename remove_reference<_Tp>::type _Up; + typedef _LIBCPP_NODEBUG typename remove_reference<_Tp>::type _Up; public: - typedef _LIBCPP_NODEBUG_TYPE typename __decay<_Up, __is_referenceable<_Up>::value>::type type; + typedef _LIBCPP_NODEBUG typename __decay<_Up, __is_referenceable<_Up>::value>::type type; }; #if _LIBCPP_STD_VER > 11 @@ -1658,10 +1622,9 @@ template <class _Tp> using decay_t = typename decay<_Tp>::type; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract : public integral_constant<bool, __is_abstract(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_abstract_v - = is_abstract<_Tp>::value; +inline constexpr bool is_abstract_v = is_abstract<_Tp>::value; #endif // is_final @@ -1674,25 +1637,21 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_final : public integral_constant<bool, __is_final(_Tp)> {}; #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_final_v - = is_final<_Tp>::value; +inline constexpr bool is_final_v = is_final<_Tp>::value; #endif // is_aggregate -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) +#if _LIBCPP_STD_VER > 14 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {}; -#if !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) template <class _Tp> -_LIBCPP_INLINE_VAR constexpr bool is_aggregate_v - = is_aggregate<_Tp>::value; -#endif +inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value; -#endif // _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) +#endif // _LIBCPP_STD_VER > 14 // is_base_of @@ -1700,10 +1659,9 @@ template <class _Bp, class _Dp> struct _LIBCPP_TEMPLATE_VIS is_base_of : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Bp, class _Dp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_base_of_v - = is_base_of<_Bp, _Dp>::value; +inline constexpr bool is_base_of_v = is_base_of<_Bp, _Dp>::value; #endif // __is_core_convertible @@ -1797,10 +1755,9 @@ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible #endif // __has_feature(is_convertible_to) -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _From, class _To> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_convertible_v - = is_convertible<_From, _To>::value; +inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value; #endif // is_nothrow_convertible @@ -1860,10 +1817,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_empty : public __libcpp_empt #endif // __has_feature(is_empty) -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_empty_v - = is_empty<_Tp>::value; +inline constexpr bool is_empty_v = is_empty<_Tp>::value; #endif // is_polymorphic @@ -1886,10 +1842,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_polymorphic #endif // __has_feature(is_polymorphic) -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_polymorphic_v - = is_polymorphic<_Tp>::value; +inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value; #endif // has_virtual_destructor @@ -1906,25 +1861,21 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool has_virtual_destructor_v - = has_virtual_destructor<_Tp>::value; +inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value; #endif // has_unique_object_representations -#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS) +#if _LIBCPP_STD_VER > 14 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations : public integral_constant<bool, __has_unique_object_representations(remove_cv_t<remove_all_extents_t<_Tp>>)> {}; -#if !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool has_unique_object_representations_v - = has_unique_object_representations<_Tp>::value; -#endif +inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<_Tp>::value; #endif @@ -1933,10 +1884,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool has_unique_object_representations_v template <class _Tp> struct _LIBCPP_TEMPLATE_VIS alignment_of : public integral_constant<size_t, _LIBCPP_ALIGNOF(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR size_t alignment_of_v - = alignment_of<_Tp>::value; +inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; #endif // aligned_storage @@ -2214,26 +2164,26 @@ template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeLi template <class _Hp, class _Tp, size_t _Size> struct __find_first<__type_list<_Hp, _Tp>, _Size, true> { - typedef _LIBCPP_NODEBUG_TYPE _Hp type; + typedef _LIBCPP_NODEBUG _Hp type; }; template <class _Hp, class _Tp, size_t _Size> struct __find_first<__type_list<_Hp, _Tp>, _Size, false> { - typedef _LIBCPP_NODEBUG_TYPE typename __find_first<_Tp, _Size>::type type; + typedef _LIBCPP_NODEBUG typename __find_first<_Tp, _Size>::type type; }; template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, bool = is_volatile<typename remove_reference<_Tp>::type>::value> struct __apply_cv { - typedef _LIBCPP_NODEBUG_TYPE _Up type; + typedef _LIBCPP_NODEBUG _Up type; }; template <class _Tp, class _Up> struct __apply_cv<_Tp, _Up, true, false> { - typedef _LIBCPP_NODEBUG_TYPE const _Up type; + typedef _LIBCPP_NODEBUG const _Up type; }; template <class _Tp, class _Up> @@ -2340,7 +2290,7 @@ template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type; #ifndef _LIBCPP_CXX03_LANG template <class _Tp> -_LIBCPP_NODISCARD_ATTRIBUTE _LIBCPP_INLINE_VISIBILITY constexpr +_LIBCPP_HIDE_FROM_ABI constexpr typename make_unsigned<_Tp>::type __to_unsigned_like(_Tp __x) noexcept { return static_cast<typename make_unsigned<_Tp>::type>(__x); } @@ -2379,7 +2329,7 @@ struct __common_type2_imp<_Tp, _Up, true ? declval<_Tp>() : declval<_Up>() )>::type> { - typedef _LIBCPP_NODEBUG_TYPE typename decay<decltype( + typedef _LIBCPP_NODEBUG typename decay<decltype( true ? declval<_Tp>() : declval<_Up>() )>::type type; }; @@ -2672,16 +2622,16 @@ template <class...> struct common_reference {}; // is_assignable -template<typename, typename _Tp> struct __select_2nd { typedef _LIBCPP_NODEBUG_TYPE _Tp type; }; +template<typename, typename _Tp> struct __select_2nd { typedef _LIBCPP_NODEBUG _Tp type; }; #if __has_keyword(__is_assignable) template<class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, class _Arg> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_assignable_v = __is_assignable(_Tp, _Arg); +inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); #endif #else // __has_keyword(__is_assignable) @@ -2708,10 +2658,9 @@ template <class _Tp, class _Arg> struct is_assignable : public __is_assignable_imp<_Tp, _Arg> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, class _Arg> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_assignable_v - = is_assignable<_Tp, _Arg>::value; +inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value; #endif #endif // __has_keyword(__is_assignable) @@ -2722,10 +2671,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_copy_assignable : public is_assignable<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_copy_assignable_v - = is_copy_assignable<_Tp>::value; +inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; #endif // is_move_assignable @@ -2734,10 +2682,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable : public is_assignable<typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_move_assignable_v - = is_move_assignable<_Tp>::value; +inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; #endif // is_destructible @@ -2747,9 +2694,9 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_move_assignable_v template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_destructible : _BoolConstant<__is_destructible(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_destructible_v = __is_destructible(_Tp); +inline constexpr bool is_destructible_v = __is_destructible(_Tp); #endif #else // __has_keyword(__is_destructible) @@ -2810,10 +2757,9 @@ template <> struct is_destructible<void> : public false_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_destructible_v - = is_destructible<_Tp>::value; +inline constexpr bool is_destructible_v = is_destructible<_Tp>::value; #endif #endif // __has_keyword(__is_destructible) @@ -3049,140 +2995,14 @@ struct __member_pointer_class_type<_Ret _ClassType::*> { // template <class T, class... Args> struct is_constructible; -#if defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER_NEW >= 10000 -# define _LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE -#endif - -#if !defined(_LIBCPP_CXX03_LANG) && !__has_feature(is_constructible) && !defined(_LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE) - -template <class _Tp, class... _Args> -struct __libcpp_is_constructible; - -template <class _To, class _From> -struct __is_invalid_base_to_derived_cast { - static_assert(is_reference<_To>::value, "Wrong specialization"); - using _RawFrom = __uncvref_t<_From>; - using _RawTo = __uncvref_t<_To>; - static const bool value = _And< - _IsNotSame<_RawFrom, _RawTo>, - is_base_of<_RawFrom, _RawTo>, - _Not<__libcpp_is_constructible<_RawTo, _From>> - >::value; -}; - -template <class _To, class _From> -struct __is_invalid_lvalue_to_rvalue_cast : false_type { - static_assert(is_reference<_To>::value, "Wrong specialization"); -}; - -template <class _ToRef, class _FromRef> -struct __is_invalid_lvalue_to_rvalue_cast<_ToRef&&, _FromRef&> { - using _RawFrom = __uncvref_t<_FromRef>; - using _RawTo = __uncvref_t<_ToRef>; - static const bool value = _And< - _Not<is_function<_RawTo>>, - _Or< - _IsSame<_RawFrom, _RawTo>, - is_base_of<_RawTo, _RawFrom>> - >::value; -}; - -struct __is_constructible_helper -{ - template <class _To> - static void __eat(_To); - - // This overload is needed to work around a Clang bug that disallows - // static_cast<T&&>(e) for non-reference-compatible types. - // Example: static_cast<int&&>(declval<double>()); - // NOTE: The static_cast implementation below is required to support - // classes with explicit conversion operators. - template <class _To, class _From, - class = decltype(__eat<_To>(declval<_From>()))> - static true_type __test_cast(int); - - template <class _To, class _From, - class = decltype(static_cast<_To>(declval<_From>()))> - static integral_constant<bool, - !__is_invalid_base_to_derived_cast<_To, _From>::value && - !__is_invalid_lvalue_to_rvalue_cast<_To, _From>::value - > __test_cast(long); - - template <class, class> - static false_type __test_cast(...); - - template <class _Tp, class ..._Args, - class = decltype(_Tp(declval<_Args>()...))> - static true_type __test_nary(int); - template <class _Tp, class...> - static false_type __test_nary(...); - - template <class _Tp, class _A0, class = decltype(::new _Tp(declval<_A0>()))> - static is_destructible<_Tp> __test_unary(int); - template <class, class> - static false_type __test_unary(...); -}; - -template <class _Tp, bool = is_void<_Tp>::value> -struct __is_default_constructible - : decltype(__is_constructible_helper::__test_nary<_Tp>(0)) -{}; - -template <class _Tp> -struct __is_default_constructible<_Tp, true> : false_type {}; - -template <class _Tp> -struct __is_default_constructible<_Tp[], false> : false_type {}; - -template <class _Tp, size_t _Nx> -struct __is_default_constructible<_Tp[_Nx], false> - : __is_default_constructible<typename remove_all_extents<_Tp>::type> {}; - -template <class _Tp, class... _Args> -struct __libcpp_is_constructible -{ - static_assert(sizeof...(_Args) > 1, "Wrong specialization"); - typedef decltype(__is_constructible_helper::__test_nary<_Tp, _Args...>(0)) - type; -}; - -template <class _Tp> -struct __libcpp_is_constructible<_Tp> : __is_default_constructible<_Tp> {}; - -template <class _Tp, class _A0> -struct __libcpp_is_constructible<_Tp, _A0> - : public decltype(__is_constructible_helper::__test_unary<_Tp, _A0>(0)) -{}; - -template <class _Tp, class _A0> -struct __libcpp_is_constructible<_Tp&, _A0> - : public decltype(__is_constructible_helper:: - __test_cast<_Tp&, _A0>(0)) -{}; - -template <class _Tp, class _A0> -struct __libcpp_is_constructible<_Tp&&, _A0> - : public decltype(__is_constructible_helper:: - __test_cast<_Tp&&, _A0>(0)) -{}; - -#endif - -#if __has_feature(is_constructible) || defined(_LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE) template <class _Tp, class ..._Args> struct _LIBCPP_TEMPLATE_VIS is_constructible : public integral_constant<bool, __is_constructible(_Tp, _Args...)> - {}; -#else -template <class _Tp, class... _Args> -struct _LIBCPP_TEMPLATE_VIS is_constructible - : public __libcpp_is_constructible<_Tp, _Args...>::type {}; -#endif +{ }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, class ..._Args> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_constructible_v - = is_constructible<_Tp, _Args...>::value; +inline constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value; #endif // is_default_constructible @@ -3192,10 +3012,9 @@ struct _LIBCPP_TEMPLATE_VIS is_default_constructible : public is_constructible<_Tp> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_default_constructible_v - = is_default_constructible<_Tp>::value; +inline constexpr bool is_default_constructible_v = is_default_constructible<_Tp>::value; #endif #ifndef _LIBCPP_CXX03_LANG @@ -3229,10 +3048,9 @@ struct _LIBCPP_TEMPLATE_VIS is_copy_constructible : public is_constructible<_Tp, typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_copy_constructible_v - = is_copy_constructible<_Tp>::value; +inline constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value; #endif // is_move_constructible @@ -3242,65 +3060,22 @@ struct _LIBCPP_TEMPLATE_VIS is_move_constructible : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_move_constructible_v - = is_move_constructible<_Tp>::value; +inline constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value; #endif // is_trivially_constructible -#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501 - template <class _Tp, class... _Args> struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> { }; -#else // !__has_feature(is_trivially_constructible) - -template <class _Tp, class... _Args> -struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible - : false_type -{ -}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp> -#if __has_feature(has_trivial_constructor) || defined(_LIBCPP_COMPILER_GCC) - : integral_constant<bool, __has_trivial_constructor(_Tp)> -#else - : integral_constant<bool, is_scalar<_Tp>::value> -#endif -{ -}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&&> - : integral_constant<bool, is_scalar<_Tp>::value> -{ -}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, const _Tp&> - : integral_constant<bool, is_scalar<_Tp>::value> -{ -}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&> - : integral_constant<bool, is_scalar<_Tp>::value> -{ -}; - -#endif // !__has_feature(is_trivially_constructible) - - -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, class... _Args> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_constructible_v - = is_trivially_constructible<_Tp, _Args...>::value; +inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<_Tp, _Args...>::value; #endif // is_trivially_default_constructible @@ -3309,10 +3084,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructi : public is_trivially_constructible<_Tp> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v - = is_trivially_default_constructible<_Tp>::value; +inline constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible<_Tp>::value; #endif // is_trivially_copy_constructible @@ -3321,10 +3095,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v - = is_trivially_copy_constructible<_Tp>::value; +inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible<_Tp>::value; #endif // is_trivially_move_constructible @@ -3333,50 +3106,21 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v - = is_trivially_move_constructible<_Tp>::value; +inline constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible<_Tp>::value; #endif // is_trivially_assignable -#if __has_feature(is_trivially_assignable) || _GNUC_VER >= 501 - template <class _Tp, class _Arg> struct is_trivially_assignable : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> -{ -}; - -#else // !__has_feature(is_trivially_assignable) - -template <class _Tp, class _Arg> -struct is_trivially_assignable - : public false_type {}; - -template <class _Tp> -struct is_trivially_assignable<_Tp&, _Tp> - : integral_constant<bool, is_scalar<_Tp>::value> {}; - -template <class _Tp> -struct is_trivially_assignable<_Tp&, _Tp&> - : integral_constant<bool, is_scalar<_Tp>::value> {}; - -template <class _Tp> -struct is_trivially_assignable<_Tp&, const _Tp&> - : integral_constant<bool, is_scalar<_Tp>::value> {}; - -template <class _Tp> -struct is_trivially_assignable<_Tp&, _Tp&&> - : integral_constant<bool, is_scalar<_Tp>::value> {}; - -#endif // !__has_feature(is_trivially_assignable) +{ }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, class _Arg> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_assignable_v - = is_trivially_assignable<_Tp, _Arg>::value; +inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<_Tp, _Arg>::value; #endif // is_trivially_copy_assignable @@ -3385,10 +3129,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v - = is_trivially_copy_assignable<_Tp>::value; +inline constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable<_Tp>::value; #endif // is_trivially_move_assignable @@ -3398,10 +3141,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v - = is_trivially_move_assignable<_Tp>::value; +inline constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable<_Tp>::value; #endif // is_trivially_destructible @@ -3430,10 +3172,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible<_Tp[] #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_destructible_v - = is_trivially_destructible<_Tp>::value; +inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<_Tp>::value; #endif // is_nothrow_constructible @@ -3484,10 +3225,9 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]> #endif // _LIBCPP_HAS_NO_NOEXCEPT -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, class ..._Args> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v - = is_nothrow_constructible<_Tp, _Args...>::value; +inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value; #endif // is_nothrow_default_constructible @@ -3496,10 +3236,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructibl : public is_nothrow_constructible<_Tp> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v - = is_nothrow_default_constructible<_Tp>::value; +inline constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible<_Tp>::value; #endif // is_nothrow_copy_constructible @@ -3508,10 +3247,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible : public is_nothrow_constructible<_Tp, typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v - = is_nothrow_copy_constructible<_Tp>::value; +inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value; #endif // is_nothrow_move_constructible @@ -3520,10 +3258,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v - = is_nothrow_move_constructible<_Tp>::value; +inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value; #endif // is_nothrow_assignable @@ -3558,10 +3295,9 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable #endif // _LIBCPP_HAS_NO_NOEXCEPT -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp, class _Arg> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v - = is_nothrow_assignable<_Tp, _Arg>::value; +inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<_Tp, _Arg>::value; #endif // is_nothrow_copy_assignable @@ -3570,10 +3306,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v - = is_nothrow_copy_assignable<_Tp>::value; +inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable<_Tp>::value; #endif // is_nothrow_move_assignable @@ -3583,10 +3318,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v - = is_nothrow_move_assignable<_Tp>::value; +inline constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable<_Tp>::value; #endif // is_nothrow_destructible @@ -3646,10 +3380,9 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[]> #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v - = is_nothrow_destructible<_Tp>::value; +inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value; #endif // is_pod @@ -3669,10 +3402,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_pod_v - = is_pod<_Tp>::value; +inline constexpr bool is_pod_v = is_pod<_Tp>::value; #endif // is_literal_type; @@ -3682,11 +3414,10 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_ : public integral_constant<bool, __is_literal_type(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_literal_type_v - = is_literal_type<_Tp>::value; -#endif // _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; +#endif // _LIBCPP_STD_VER > 14 #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) // is_standard_layout; @@ -3699,28 +3430,20 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout #endif {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_standard_layout_v - = is_standard_layout<_Tp>::value; +inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; #endif // is_trivially_copyable; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable -#if __has_feature(is_trivially_copyable) : public integral_constant<bool, __is_trivially_copyable(_Tp)> -#elif _GNUC_VER >= 501 - : public integral_constant<bool, !is_volatile<_Tp>::value && __is_trivially_copyable(_Tp)> -#else - : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> -#endif {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copyable_v - = is_trivially_copyable<_Tp>::value; +inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value; #endif // is_trivial; @@ -3734,10 +3457,9 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial #endif {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivial_v - = is_trivial<_Tp>::value; +inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; #endif template <class _Tp> struct __is_reference_wrapper_impl : public false_type {}; @@ -3811,10 +3533,6 @@ using __enable_if_bullet6 = typename enable_if // fall back - none of the bullets -#define _LIBCPP_INVOKE_RETURN(...) \ - noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) \ - { return __VA_ARGS__; } - template <class ..._Args> auto __invoke(__any, _Args&& ...__args) -> __nat; @@ -3828,42 +3546,54 @@ template <class _Fp, class _A0, class ..._Args, inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -_LIBCPP_INVOKE_RETURN((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)) + noexcept(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...))) + -> decltype( (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)) + { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); } template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet1<_Fp, _A0>> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR auto __invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -_LIBCPP_INVOKE_RETURN((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)) + noexcept(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...))) + -> decltype( (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)) + { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); } template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet2<_Fp, _A0>> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -_LIBCPP_INVOKE_RETURN((__a0.get().*__f)(static_cast<_Args&&>(__args)...)) + noexcept(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...))) + -> decltype( (__a0.get().*__f)(static_cast<_Args&&>(__args)...)) + { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); } template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet2<_Fp, _A0>> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR auto __invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -_LIBCPP_INVOKE_RETURN((__a0.get().*__f)(static_cast<_Args&&>(__args)...)) + noexcept(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...))) + -> decltype( (__a0.get().*__f)(static_cast<_Args&&>(__args)...)) + { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); } template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet3<_Fp, _A0>> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -_LIBCPP_INVOKE_RETURN(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)) + noexcept(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...))) + -> decltype( ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)) + { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); } template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet3<_Fp, _A0>> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR auto __invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -_LIBCPP_INVOKE_RETURN(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)) + noexcept(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...))) + -> decltype( ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)) + { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); } // bullets 4, 5 and 6 @@ -3872,42 +3602,54 @@ template <class _Fp, class _A0, inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 auto __invoke(_Fp&& __f, _A0&& __a0) -_LIBCPP_INVOKE_RETURN(static_cast<_A0&&>(__a0).*__f) + noexcept(noexcept(static_cast<_A0&&>(__a0).*__f)) + -> decltype( static_cast<_A0&&>(__a0).*__f) + { return static_cast<_A0&&>(__a0).*__f; } template <class _Fp, class _A0, class = __enable_if_bullet4<_Fp, _A0>> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR auto __invoke_constexpr(_Fp&& __f, _A0&& __a0) -_LIBCPP_INVOKE_RETURN(static_cast<_A0&&>(__a0).*__f) + noexcept(noexcept(static_cast<_A0&&>(__a0).*__f)) + -> decltype( static_cast<_A0&&>(__a0).*__f) + { return static_cast<_A0&&>(__a0).*__f; } template <class _Fp, class _A0, class = __enable_if_bullet5<_Fp, _A0>> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 auto __invoke(_Fp&& __f, _A0&& __a0) -_LIBCPP_INVOKE_RETURN(__a0.get().*__f) + noexcept(noexcept(__a0.get().*__f)) + -> decltype( __a0.get().*__f) + { return __a0.get().*__f; } template <class _Fp, class _A0, class = __enable_if_bullet5<_Fp, _A0>> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR auto __invoke_constexpr(_Fp&& __f, _A0&& __a0) -_LIBCPP_INVOKE_RETURN(__a0.get().*__f) + noexcept(noexcept(__a0.get().*__f)) + -> decltype( __a0.get().*__f) + { return __a0.get().*__f; } template <class _Fp, class _A0, class = __enable_if_bullet6<_Fp, _A0>> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 auto __invoke(_Fp&& __f, _A0&& __a0) -_LIBCPP_INVOKE_RETURN((*static_cast<_A0&&>(__a0)).*__f) + noexcept(noexcept((*static_cast<_A0&&>(__a0)).*__f)) + -> decltype( (*static_cast<_A0&&>(__a0)).*__f) + { return (*static_cast<_A0&&>(__a0)).*__f; } template <class _Fp, class _A0, class = __enable_if_bullet6<_Fp, _A0>> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR auto __invoke_constexpr(_Fp&& __f, _A0&& __a0) -_LIBCPP_INVOKE_RETURN((*static_cast<_A0&&>(__a0)).*__f) + noexcept(noexcept((*static_cast<_A0&&>(__a0)).*__f)) + -> decltype( (*static_cast<_A0&&>(__a0)).*__f) + { return (*static_cast<_A0&&>(__a0)).*__f; } // bullet 7 @@ -3915,15 +3657,17 @@ template <class _Fp, class ..._Args> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 auto __invoke(_Fp&& __f, _Args&& ...__args) -_LIBCPP_INVOKE_RETURN(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)) + noexcept(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...))) + -> decltype( static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)) + { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); } template <class _Fp, class ..._Args> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR auto __invoke_constexpr(_Fp&& __f, _Args&& ...__args) -_LIBCPP_INVOKE_RETURN(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)) - -#undef _LIBCPP_INVOKE_RETURN + noexcept(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...))) + -> decltype( static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)) + { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); } // __invokable template <class _Ret, class _Fp, class ..._Args> @@ -4122,12 +3866,10 @@ struct _LIBCPP_TEMPLATE_VIS is_invocable_r : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {}; template <class _Fn, class ..._Args> -_LIBCPP_INLINE_VAR constexpr bool is_invocable_v - = is_invocable<_Fn, _Args...>::value; +inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value; template <class _Ret, class _Fn, class ..._Args> -_LIBCPP_INLINE_VAR constexpr bool is_invocable_r_v - = is_invocable_r<_Ret, _Fn, _Args...>::value; +inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value; // is_nothrow_invocable @@ -4140,12 +3882,10 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r : integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value> {}; template <class _Fn, class ..._Args> -_LIBCPP_INLINE_VAR constexpr bool is_nothrow_invocable_v - = is_nothrow_invocable<_Fn, _Args...>::value; +inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value; template <class _Ret, class _Fn, class ..._Args> -_LIBCPP_INLINE_VAR constexpr bool is_nothrow_invocable_r_v - = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value; +inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value; #endif // _LIBCPP_STD_VER > 14 @@ -4268,20 +4008,16 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable }; template <class _Tp, class _Up> -_LIBCPP_INLINE_VAR constexpr bool is_swappable_with_v - = is_swappable_with<_Tp, _Up>::value; +inline constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value; template <class _Tp> -_LIBCPP_INLINE_VAR constexpr bool is_swappable_v - = is_swappable<_Tp>::value; +inline constexpr bool is_swappable_v = is_swappable<_Tp>::value; template <class _Tp, class _Up> -_LIBCPP_INLINE_VAR constexpr bool is_nothrow_swappable_with_v - = is_nothrow_swappable_with<_Tp, _Up>::value; +inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value; template <class _Tp> -_LIBCPP_INLINE_VAR constexpr bool is_nothrow_swappable_v - = is_nothrow_swappable<_Tp>::value; +inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value; #endif // _LIBCPP_STD_VER > 14 @@ -4349,40 +4085,6 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename __sfinae_underlying_type<_Tp>::__promoted_type __convert_to_integral(_Tp __val) { return __val; } -#ifndef _LIBCPP_CXX03_LANG - -template <class _Tp> -struct __has_operator_addressof_member_imp -{ - template <class _Up> - static auto __test(int) - -> typename __select_2nd<decltype(declval<_Up>().operator&()), true_type>::type; - template <class> - static auto __test(long) -> false_type; - - static const bool value = decltype(__test<_Tp>(0))::value; -}; - -template <class _Tp> -struct __has_operator_addressof_free_imp -{ - template <class _Up> - static auto __test(int) - -> typename __select_2nd<decltype(operator&(declval<_Up>())), true_type>::type; - template <class> - static auto __test(long) -> false_type; - - static const bool value = decltype(__test<_Tp>(0))::value; -}; - -template <class _Tp> -struct __has_operator_addressof - : public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value - || __has_operator_addressof_free_imp<_Tp>::value> -{}; - -#endif // _LIBCPP_CXX03_LANG - // is_scoped_enum [meta.unary.prop] #if _LIBCPP_STD_VER > 20 @@ -4398,8 +4100,7 @@ struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : public __is_scoped_enum_helper<_Tp> {}; template <class _Tp> -_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_scoped_enum_v = - is_scoped_enum<_Tp>::value; +inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; #endif #if _LIBCPP_STD_VER > 14 @@ -4407,20 +4108,17 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_scoped_enum_v = template <class... _Args> struct conjunction : _And<_Args...> {}; template<class... _Args> -_LIBCPP_INLINE_VAR constexpr bool conjunction_v - = conjunction<_Args...>::value; +inline constexpr bool conjunction_v = conjunction<_Args...>::value; template <class... _Args> struct disjunction : _Or<_Args...> {}; template<class... _Args> -_LIBCPP_INLINE_VAR constexpr bool disjunction_v - = disjunction<_Args...>::value; +inline constexpr bool disjunction_v = disjunction<_Args...>::value; template <class _Tp> struct negation : _Not<_Tp> {}; template<class _Tp> -_LIBCPP_INLINE_VAR constexpr bool negation_v - = negation<_Tp>::value; +inline constexpr bool negation_v = negation<_Tp>::value; #endif // _LIBCPP_STD_VER > 14 // These traits are used in __tree and __hash_table @@ -4453,7 +4151,6 @@ template <class _ValTy, class _Key, class _RawValTy> struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> : false_type {}; -#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED #if _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY inline constexpr bool is_constant_evaluated() noexcept { @@ -4463,10 +4160,6 @@ inline constexpr bool is_constant_evaluated() noexcept { inline _LIBCPP_CONSTEXPR bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); } -#else -inline _LIBCPP_CONSTEXPR -bool __libcpp_is_constant_evaluated() _NOEXCEPT { return false; } -#endif template <class _CharT> using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >; @@ -4481,13 +4174,4 @@ using __maybe_const = conditional_t<_Const, const _Tp, _Tp>; _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 -// std::byte -namespace std // purposefully not versioned -{ - - -} -#endif - #endif // _LIBCPP_TYPE_TRAITS |
