diff --git a/libcxx/include/__type_traits/alignment_of.h b/libcxx/include/__type_traits/alignment_of.h --- a/libcxx/include/__type_traits/alignment_of.h +++ b/libcxx/include/__type_traits/alignment_of.h @@ -24,7 +24,7 @@ #if _LIBCPP_STD_VER > 14 template -inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; +inline constexpr size_t alignment_of_v = _LIBCPP_ALIGNOF(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/apply_cv.h b/libcxx/include/__type_traits/apply_cv.h --- a/libcxx/include/__type_traits/apply_cv.h +++ b/libcxx/include/__type_traits/apply_cv.h @@ -10,7 +10,6 @@ #define _LIBCPP___TYPE_TRAITS_APPLY_CV_H #include <__config> -#include <__type_traits/integral_constant.h> #include <__type_traits/is_const.h> #include <__type_traits/is_volatile.h> #include <__type_traits/remove_reference.h> diff --git a/libcxx/include/__type_traits/decay.h b/libcxx/include/__type_traits/decay.h --- a/libcxx/include/__type_traits/decay.h +++ b/libcxx/include/__type_traits/decay.h @@ -12,7 +12,6 @@ #include <__config> #include <__type_traits/add_pointer.h> #include <__type_traits/conditional.h> -#include <__type_traits/integral_constant.h> #include <__type_traits/is_array.h> #include <__type_traits/is_function.h> #include <__type_traits/is_referenceable.h> diff --git a/libcxx/include/__type_traits/disjunction.h b/libcxx/include/__type_traits/disjunction.h --- a/libcxx/include/__type_traits/disjunction.h +++ b/libcxx/include/__type_traits/disjunction.h @@ -10,7 +10,6 @@ #define _LIBCPP___TYPE_TRAITS_DISJUNCTION_H #include <__config> -#include <__type_traits/conditional.h> #include <__type_traits/integral_constant.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/__type_traits/extent.h b/libcxx/include/__type_traits/extent.h --- a/libcxx/include/__type_traits/extent.h +++ b/libcxx/include/__type_traits/extent.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__array_extent) +#if __has_builtin(__array_extent) template struct _LIBCPP_TEMPLATE_VIS extent @@ -30,7 +30,7 @@ inline constexpr size_t extent_v = __array_extent(_Tp, _Ip); #endif -#else // __has_keyword(__array_extent) +#else // __has_builtin(__array_extent) template struct _LIBCPP_TEMPLATE_VIS extent : public integral_constant {}; @@ -48,7 +48,7 @@ inline constexpr size_t extent_v = extent<_Tp, _Ip>::value; #endif -#endif // __has_keyword(__array_extent) +#endif // __has_builtin(__array_extent) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/has_virtual_destructor.h b/libcxx/include/__type_traits/has_virtual_destructor.h --- a/libcxx/include/__type_traits/has_virtual_destructor.h +++ b/libcxx/include/__type_traits/has_virtual_destructor.h @@ -18,21 +18,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC) - template struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor : public integral_constant {}; -#else - -template struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor - : public false_type {}; - -#endif - #if _LIBCPP_STD_VER > 14 template -inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value; +inline constexpr bool has_virtual_destructor_v = __has_virtual_destructor(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_array.h b/libcxx/include/__type_traits/is_array.h --- a/libcxx/include/__type_traits/is_array.h +++ b/libcxx/include/__type_traits/is_array.h @@ -21,7 +21,7 @@ // TODO: Clang incorrectly reports that __is_array is true for T[0]. // Re-enable the branch once https://llvm.org/PR54705 is fixed. -#if __has_keyword(__is_array) && 0 +#if __has_builtin(__is_array) && 0 template struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> { }; @@ -45,7 +45,7 @@ inline constexpr bool is_array_v = is_array<_Tp>::value; #endif -#endif // __has_keyword(__is_array) +#endif // __has_builtin(__is_array) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_assignable.h b/libcxx/include/__type_traits/is_assignable.h --- a/libcxx/include/__type_traits/is_assignable.h +++ b/libcxx/include/__type_traits/is_assignable.h @@ -18,10 +18,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template struct __select_2nd { typedef _LIBCPP_NODEBUG _Tp type; }; - -#if __has_keyword(__is_assignable) - template struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { }; @@ -30,37 +26,6 @@ inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); #endif -#else // __has_keyword(__is_assignable) - -template -typename __select_2nd() = declval<_Arg>())), true_type>::type -__is_assignable_test(int); - -template -false_type __is_assignable_test(...); - - -template ::value || is_void<_Arg>::value> -struct __is_assignable_imp - : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {}; - -template -struct __is_assignable_imp<_Tp, _Arg, true> - : public false_type -{ -}; - -template -struct is_assignable - : public __is_assignable_imp<_Tp, _Arg> {}; - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value; -#endif - -#endif // __has_keyword(__is_assignable) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_H diff --git a/libcxx/include/__type_traits/is_class.h b/libcxx/include/__type_traits/is_class.h --- a/libcxx/include/__type_traits/is_class.h +++ b/libcxx/include/__type_traits/is_class.h @@ -11,8 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_union.h> -#include <__type_traits/remove_cv.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__type_traits/is_compound.h b/libcxx/include/__type_traits/is_compound.h --- a/libcxx/include/__type_traits/is_compound.h +++ b/libcxx/include/__type_traits/is_compound.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_compound) +#if __has_builtin(__is_compound) template struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> { }; @@ -29,7 +29,7 @@ inline constexpr bool is_compound_v = __is_compound(_Tp); #endif -#else // __has_keyword(__is_compound) +#else // __has_builtin(__is_compound) template struct _LIBCPP_TEMPLATE_VIS is_compound : public integral_constant::value> {}; @@ -39,7 +39,7 @@ inline constexpr bool is_compound_v = is_compound<_Tp>::value; #endif -#endif // __has_keyword(__is_compound) +#endif // __has_builtin(__is_compound) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_const.h b/libcxx/include/__type_traits/is_const.h --- a/libcxx/include/__type_traits/is_const.h +++ b/libcxx/include/__type_traits/is_const.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_const) +#if __has_builtin(__is_const) template struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { }; @@ -38,7 +38,7 @@ inline constexpr bool is_const_v = is_const<_Tp>::value; #endif -#endif // __has_keyword(__is_const) +#endif // __has_builtin(__is_const) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_constructible.h b/libcxx/include/__type_traits/is_constructible.h --- a/libcxx/include/__type_traits/is_constructible.h +++ b/libcxx/include/__type_traits/is_constructible.h @@ -25,7 +25,7 @@ #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value; +inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_convertible.h b/libcxx/include/__type_traits/is_convertible.h --- a/libcxx/include/__type_traits/is_convertible.h +++ b/libcxx/include/__type_traits/is_convertible.h @@ -24,12 +24,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) +#if __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) template struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant {}; -#else // __has_feature(is_convertible_to) +#else // __has_builtin(__is_convertible_to) namespace __is_convertible_imp { @@ -96,7 +96,7 @@ static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; }; -#endif // __has_feature(is_convertible_to) +#endif // __has_builtin(__is_convertible_to) #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_copy_assignable.h b/libcxx/include/__type_traits/is_copy_assignable.h --- a/libcxx/include/__type_traits/is_copy_assignable.h +++ b/libcxx/include/__type_traits/is_copy_assignable.h @@ -13,7 +13,6 @@ #include <__type_traits/add_const.h> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_assignable.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,9 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template struct _LIBCPP_TEMPLATE_VIS is_copy_assignable - : public is_assignable::type, - typename add_lvalue_reference::type>::type> {}; +template +struct _LIBCPP_TEMPLATE_VIS is_copy_assignable + : public integral_constant< + bool, + __is_assignable(typename add_lvalue_reference<_Tp>::type, + typename add_lvalue_reference::type>::type)> {}; #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_copy_constructible.h b/libcxx/include/__type_traits/is_copy_constructible.h --- a/libcxx/include/__type_traits/is_copy_constructible.h +++ b/libcxx/include/__type_traits/is_copy_constructible.h @@ -13,7 +13,6 @@ #include <__type_traits/add_const.h> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_constructible.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -23,8 +22,9 @@ template struct _LIBCPP_TEMPLATE_VIS is_copy_constructible - : public is_constructible<_Tp, - typename add_lvalue_reference::type>::type> {}; + : public integral_constant< + bool, + __is_constructible(_Tp, typename add_lvalue_reference::type>::type)> {}; #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_default_constructible.h b/libcxx/include/__type_traits/is_default_constructible.h --- a/libcxx/include/__type_traits/is_default_constructible.h +++ b/libcxx/include/__type_traits/is_default_constructible.h @@ -11,7 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_constructible.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,12 +20,12 @@ template struct _LIBCPP_TEMPLATE_VIS is_default_constructible - : public is_constructible<_Tp> + : public integral_constant {}; #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_default_constructible_v = is_default_constructible<_Tp>::value; +inline constexpr bool is_default_constructible_v = __is_constructible(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_destructible.h b/libcxx/include/__type_traits/is_destructible.h --- a/libcxx/include/__type_traits/is_destructible.h +++ b/libcxx/include/__type_traits/is_destructible.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_destructible) +#if __has_builtin(__is_destructible) template struct _LIBCPP_TEMPLATE_VIS is_destructible : _BoolConstant<__is_destructible(_Tp)> { }; @@ -32,7 +32,7 @@ inline constexpr bool is_destructible_v = __is_destructible(_Tp); #endif -#else // __has_keyword(__is_destructible) +#else // __has_builtin(__is_destructible) // if it's a reference, return true // if it's a function, return false @@ -95,7 +95,7 @@ inline constexpr bool is_destructible_v = is_destructible<_Tp>::value; #endif -#endif // __has_keyword(__is_destructible) +#endif // __has_builtin(__is_destructible) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_enum.h b/libcxx/include/__type_traits/is_enum.h --- a/libcxx/include/__type_traits/is_enum.h +++ b/libcxx/include/__type_traits/is_enum.h @@ -11,7 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__type_traits/remove_cv.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__type_traits/is_function.h b/libcxx/include/__type_traits/is_function.h --- a/libcxx/include/__type_traits/is_function.h +++ b/libcxx/include/__type_traits/is_function.h @@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_function) +#if __has_builtin(__is_function) template struct _LIBCPP_TEMPLATE_VIS is_function : integral_constant {}; @@ -31,7 +31,7 @@ struct _LIBCPP_TEMPLATE_VIS is_function : public integral_constant::value || is_const::value)> {}; -#endif // __has_keyword(__is_function) +#endif // __has_builtin(__is_function) #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_fundamental.h b/libcxx/include/__type_traits/is_fundamental.h --- a/libcxx/include/__type_traits/is_fundamental.h +++ b/libcxx/include/__type_traits/is_fundamental.h @@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_fundamental) +#if __has_builtin(__is_fundamental) template struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> { }; @@ -30,7 +30,7 @@ inline constexpr bool is_fundamental_v = __is_fundamental(_Tp); #endif -#else // __has_keyword(__is_fundamental) +#else // __has_builtin(__is_fundamental) template struct _LIBCPP_TEMPLATE_VIS is_fundamental : public integral_constant::value || @@ -42,7 +42,7 @@ inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; #endif -#endif // __has_keyword(__is_fundamental) +#endif // __has_builtin(__is_fundamental) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_integral.h b/libcxx/include/__type_traits/is_integral.h --- a/libcxx/include/__type_traits/is_integral.h +++ b/libcxx/include/__type_traits/is_integral.h @@ -45,7 +45,7 @@ template <> struct __libcpp_is_integral<__uint128_t> { enum { value = 1 }; }; #endif -#if __has_keyword(__is_integral) +#if __has_builtin(__is_integral) template struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> { }; @@ -65,7 +65,7 @@ inline constexpr bool is_integral_v = is_integral<_Tp>::value; #endif -#endif // __has_keyword(__is_integral) +#endif // __has_builtin(__is_integral) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_literal_type.h b/libcxx/include/__type_traits/is_literal_type.h --- a/libcxx/include/__type_traits/is_literal_type.h +++ b/libcxx/include/__type_traits/is_literal_type.h @@ -25,7 +25,7 @@ #if _LIBCPP_STD_VER > 14 template -_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; +_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = __is_literal_type(_Tp); #endif // _LIBCPP_STD_VER > 14 #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) diff --git a/libcxx/include/__type_traits/is_member_function_pointer.h b/libcxx/include/__type_traits/is_member_function_pointer.h --- a/libcxx/include/__type_traits/is_member_function_pointer.h +++ b/libcxx/include/__type_traits/is_member_function_pointer.h @@ -36,7 +36,7 @@ }; }; -#if __has_keyword(__is_member_function_pointer) +#if __has_builtin(__is_member_function_pointer) template struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer @@ -47,7 +47,7 @@ inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); #endif -#else // __has_keyword(__is_member_function_pointer) +#else // __has_builtin(__is_member_function_pointer) template struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : public _BoolConstant< __libcpp_is_member_pointer::type>::__is_func > {}; @@ -57,7 +57,7 @@ inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value; #endif -#endif // __has_keyword(__is_member_function_pointer) +#endif // __has_builtin(__is_member_function_pointer) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_member_object_pointer.h b/libcxx/include/__type_traits/is_member_object_pointer.h --- a/libcxx/include/__type_traits/is_member_object_pointer.h +++ b/libcxx/include/__type_traits/is_member_object_pointer.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_member_object_pointer) +#if __has_builtin(__is_member_object_pointer) template struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer @@ -29,7 +29,7 @@ inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); #endif -#else // __has_keyword(__is_member_object_pointer) +#else // __has_builtin(__is_member_object_pointer) template struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : public _BoolConstant< __libcpp_is_member_pointer::type>::__is_obj > {}; @@ -39,7 +39,7 @@ inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value; #endif -#endif // __has_keyword(__is_member_object_pointer) +#endif // __has_builtin(__is_member_object_pointer) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_member_pointer.h b/libcxx/include/__type_traits/is_member_pointer.h --- a/libcxx/include/__type_traits/is_member_pointer.h +++ b/libcxx/include/__type_traits/is_member_pointer.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_member_pointer) +#if __has_builtin(__is_member_pointer) template struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> { }; @@ -28,7 +28,7 @@ inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); #endif -#else // __has_keyword(__is_member_pointer) +#else // __has_builtin(__is_member_pointer) template struct _LIBCPP_TEMPLATE_VIS is_member_pointer : public _BoolConstant< __libcpp_is_member_pointer::type>::__is_member > {}; @@ -38,7 +38,7 @@ inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; #endif -#endif // __has_keyword(__is_member_pointer) +#endif // __has_builtin(__is_member_pointer) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_move_assignable.h b/libcxx/include/__type_traits/is_move_assignable.h --- a/libcxx/include/__type_traits/is_move_assignable.h +++ b/libcxx/include/__type_traits/is_move_assignable.h @@ -10,11 +10,9 @@ #define _LIBCPP___TYPE_TRAITS_IS_MOVE_ASSIGNABLE_H #include <__config> -#include <__type_traits/add_const.h> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/add_rvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_assignable.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,9 +20,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template struct _LIBCPP_TEMPLATE_VIS is_move_assignable - : public is_assignable::type, - typename add_rvalue_reference<_Tp>::type> {}; +template +struct _LIBCPP_TEMPLATE_VIS is_move_assignable + : public integral_constant< + bool, + __is_assignable(typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type)> {}; #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_move_constructible.h b/libcxx/include/__type_traits/is_move_constructible.h --- a/libcxx/include/__type_traits/is_move_constructible.h +++ b/libcxx/include/__type_traits/is_move_constructible.h @@ -12,7 +12,6 @@ #include <__config> #include <__type_traits/add_rvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_constructible.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,7 +21,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_move_constructible - : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> + : public integral_constant::type)> {}; #if _LIBCPP_STD_VER > 14 diff --git a/libcxx/include/__type_traits/is_nothrow_assignable.h b/libcxx/include/__type_traits/is_nothrow_assignable.h --- a/libcxx/include/__type_traits/is_nothrow_assignable.h +++ b/libcxx/include/__type_traits/is_nothrow_assignable.h @@ -10,7 +10,6 @@ #define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_ASSIGNABLE_H #include <__config> -#include <__type_traits/add_const.h> #include <__type_traits/integral_constant.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -19,39 +18,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_nothrow_assignable) - template struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable : public integral_constant {}; -#else - -template struct __libcpp_is_nothrow_assignable; - -template -struct __libcpp_is_nothrow_assignable - : public false_type -{ -}; - -template -struct __libcpp_is_nothrow_assignable - : public integral_constant() = declval<_Arg>()) > -{ -}; - -template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable - : public __libcpp_is_nothrow_assignable::value, _Tp, _Arg> -{ -}; - -#endif // _LIBCPP_HAS_NO_NOEXCEPT - #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<_Tp, _Arg>::value; +inline constexpr bool is_nothrow_assignable_v = __is_nothrow_assignable(_Tp, _Arg); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_nothrow_constructible.h b/libcxx/include/__type_traits/is_nothrow_constructible.h --- a/libcxx/include/__type_traits/is_nothrow_constructible.h +++ b/libcxx/include/__type_traits/is_nothrow_constructible.h @@ -11,7 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__utility/declval.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -19,55 +18,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_nothrow_constructible) - template struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible : public integral_constant {}; -#else - -template struct __libcpp_is_nothrow_constructible; - -template -struct __libcpp_is_nothrow_constructible - : public integral_constant()...))> -{ -}; - -template -void __implicit_conversion_to(_Tp) noexcept { } - -template -struct __libcpp_is_nothrow_constructible - : public integral_constant(declval<_Arg>()))> -{ -}; - -template -struct __libcpp_is_nothrow_constructible - : public false_type -{ -}; - -template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible - : __libcpp_is_nothrow_constructible::value, is_reference<_Tp>::value, _Tp, _Args...> -{ -}; - -template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]> - : __libcpp_is_nothrow_constructible::value, is_reference<_Tp>::value, _Tp> -{ -}; - -#endif // _LIBCPP_HAS_NO_NOEXCEPT - - #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value; +inline constexpr bool is_nothrow_constructible_v = __is_nothrow_constructible(_Tp, _Args...); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_nothrow_copy_assignable.h b/libcxx/include/__type_traits/is_nothrow_copy_assignable.h --- a/libcxx/include/__type_traits/is_nothrow_copy_assignable.h +++ b/libcxx/include/__type_traits/is_nothrow_copy_assignable.h @@ -13,7 +13,6 @@ #include <__type_traits/add_const.h> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_nothrow_assignable.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,9 +20,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable - : public is_nothrow_assignable::type, - typename add_lvalue_reference::type>::type> {}; +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable + : public integral_constant< + bool, + __is_nothrow_assignable( + typename add_lvalue_reference<_Tp>::type, + typename add_lvalue_reference::type>::type)> {}; #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_nothrow_copy_constructible.h b/libcxx/include/__type_traits/is_nothrow_copy_constructible.h --- a/libcxx/include/__type_traits/is_nothrow_copy_constructible.h +++ b/libcxx/include/__type_traits/is_nothrow_copy_constructible.h @@ -13,7 +13,6 @@ #include <__type_traits/add_const.h> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_nothrow_constructible.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,9 +20,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible - : public is_nothrow_constructible<_Tp, - typename add_lvalue_reference::type>::type> {}; +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible + : public integral_constant< + bool, + __is_nothrow_constructible(_Tp, typename add_lvalue_reference::type>::type)> {}; #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_nothrow_default_constructible.h b/libcxx/include/__type_traits/is_nothrow_default_constructible.h --- a/libcxx/include/__type_traits/is_nothrow_default_constructible.h +++ b/libcxx/include/__type_traits/is_nothrow_default_constructible.h @@ -11,7 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_nothrow_constructible.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,12 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructible - : public is_nothrow_constructible<_Tp> + : public integral_constant {}; #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible<_Tp>::value; +inline constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_nothrow_destructible.h b/libcxx/include/__type_traits/is_nothrow_destructible.h --- a/libcxx/include/__type_traits/is_nothrow_destructible.h +++ b/libcxx/include/__type_traits/is_nothrow_destructible.h @@ -10,7 +10,6 @@ #define _LIBCPP___TYPE_TRAITS_IS_NOTHROW_DESTRUCTIBLE_H #include <__config> -#include <__type_traits/add_const.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_destructible.h> #include <__type_traits/is_reference.h> diff --git a/libcxx/include/__type_traits/is_nothrow_move_assignable.h b/libcxx/include/__type_traits/is_nothrow_move_assignable.h --- a/libcxx/include/__type_traits/is_nothrow_move_assignable.h +++ b/libcxx/include/__type_traits/is_nothrow_move_assignable.h @@ -13,7 +13,6 @@ #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/add_rvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_nothrow_assignable.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,10 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable - : public is_nothrow_assignable::type, - typename add_rvalue_reference<_Tp>::type> - {}; +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable + : public integral_constant< + bool, + __is_nothrow_assignable(typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type)> { +}; #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_nothrow_move_constructible.h b/libcxx/include/__type_traits/is_nothrow_move_constructible.h --- a/libcxx/include/__type_traits/is_nothrow_move_constructible.h +++ b/libcxx/include/__type_traits/is_nothrow_move_constructible.h @@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible - : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> + : public integral_constant::type)> {}; #if _LIBCPP_STD_VER > 14 diff --git a/libcxx/include/__type_traits/is_object.h b/libcxx/include/__type_traits/is_object.h --- a/libcxx/include/__type_traits/is_object.h +++ b/libcxx/include/__type_traits/is_object.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_object) +#if __has_builtin(__is_object) template struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> { }; @@ -32,7 +32,7 @@ inline constexpr bool is_object_v = __is_object(_Tp); #endif -#else // __has_keyword(__is_object) +#else // __has_builtin(__is_object) template struct _LIBCPP_TEMPLATE_VIS is_object : public integral_constant::value || @@ -45,7 +45,7 @@ inline constexpr bool is_object_v = is_object<_Tp>::value; #endif -#endif // __has_keyword(__is_object) +#endif // __has_builtin(__is_object) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_pod.h b/libcxx/include/__type_traits/is_pod.h --- a/libcxx/include/__type_traits/is_pod.h +++ b/libcxx/include/__type_traits/is_pod.h @@ -18,24 +18,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC) - template struct _LIBCPP_TEMPLATE_VIS is_pod : public integral_constant {}; -#else - -template struct _LIBCPP_TEMPLATE_VIS is_pod - : public integral_constant::value && - is_trivially_copy_constructible<_Tp>::value && - is_trivially_copy_assignable<_Tp>::value && - is_trivially_destructible<_Tp>::value> {}; - -#endif - #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_pod_v = is_pod<_Tp>::value; +inline constexpr bool is_pod_v = __is_pod(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_pointer.h b/libcxx/include/__type_traits/is_pointer.h --- a/libcxx/include/__type_traits/is_pointer.h +++ b/libcxx/include/__type_traits/is_pointer.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_pointer) +#if __has_builtin(__is_pointer) template struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { }; @@ -29,7 +29,7 @@ inline constexpr bool is_pointer_v = __is_pointer(_Tp); #endif -#else // __has_keyword(__is_pointer) +#else // __has_builtin(__is_pointer) template struct __libcpp_is_pointer : public false_type {}; template struct __libcpp_is_pointer<_Tp*> : public true_type {}; @@ -50,7 +50,7 @@ inline constexpr bool is_pointer_v = is_pointer<_Tp>::value; #endif -#endif // __has_keyword(__is_pointer) +#endif // __has_builtin(__is_pointer) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_reference.h b/libcxx/include/__type_traits/is_reference.h --- a/libcxx/include/__type_traits/is_reference.h +++ b/libcxx/include/__type_traits/is_reference.h @@ -18,9 +18,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_lvalue_reference) && \ - __has_keyword(__is_rvalue_reference) && \ - __has_keyword(__is_reference) +#if __has_builtin(__is_lvalue_reference) && \ + __has_builtin(__is_rvalue_reference) && \ + __has_builtin(__is_reference) template struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { }; @@ -40,7 +40,7 @@ inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp); #endif -#else // __has_keyword(__is_lvalue_reference) && etc... +#else // __has_builtin(__is_lvalue_reference) && etc... template struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {}; template struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {}; @@ -63,7 +63,7 @@ inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value; #endif -#endif // __has_keyword(__is_lvalue_reference) && etc... +#endif // __has_builtin(__is_lvalue_reference) && etc... _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_scalar.h b/libcxx/include/__type_traits/is_scalar.h --- a/libcxx/include/__type_traits/is_scalar.h +++ b/libcxx/include/__type_traits/is_scalar.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_scalar) +#if __has_builtin(__is_scalar) template struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> { }; @@ -32,7 +32,7 @@ inline constexpr bool is_scalar_v = __is_scalar(_Tp); #endif -#else // __has_keyword(__is_scalar) +#else // __has_builtin(__is_scalar) template struct __is_block : false_type {}; #if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) @@ -54,7 +54,7 @@ inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; #endif -#endif // __has_keyword(__is_scalar) +#endif // __has_builtin(__is_scalar) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_signed.h b/libcxx/include/__type_traits/is_signed.h --- a/libcxx/include/__type_traits/is_signed.h +++ b/libcxx/include/__type_traits/is_signed.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_signed) +#if __has_builtin(__is_signed) template struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> { }; @@ -28,7 +28,7 @@ inline constexpr bool is_signed_v = __is_signed(_Tp); #endif -#else // __has_keyword(__is_signed) +#else // __has_builtin(__is_signed) template ::value> struct __libcpp_is_signed_impl : public _BoolConstant<(_Tp(-1) < _Tp(0))> {}; @@ -48,7 +48,7 @@ inline constexpr bool is_signed_v = is_signed<_Tp>::value; #endif -#endif // __has_keyword(__is_signed) +#endif // __has_builtin(__is_signed) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_standard_layout.h b/libcxx/include/__type_traits/is_standard_layout.h --- a/libcxx/include/__type_traits/is_standard_layout.h +++ b/libcxx/include/__type_traits/is_standard_layout.h @@ -19,16 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template struct _LIBCPP_TEMPLATE_VIS is_standard_layout -#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC) : public integral_constant -#else - : integral_constant::type>::value> -#endif {}; #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; +inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_trivial.h b/libcxx/include/__type_traits/is_trivial.h --- a/libcxx/include/__type_traits/is_trivial.h +++ b/libcxx/include/__type_traits/is_trivial.h @@ -19,17 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template struct _LIBCPP_TEMPLATE_VIS is_trivial -#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC) : public integral_constant -#else - : integral_constant::value && - is_trivially_default_constructible<_Tp>::value> -#endif {}; #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; +inline constexpr bool is_trivial_v = __is_trivial(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_trivially_assignable.h b/libcxx/include/__type_traits/is_trivially_assignable.h --- a/libcxx/include/__type_traits/is_trivially_assignable.h +++ b/libcxx/include/__type_traits/is_trivially_assignable.h @@ -25,7 +25,7 @@ #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<_Tp, _Arg>::value; +inline constexpr bool is_trivially_assignable_v = __is_trivially_assignable(_Tp, _Arg); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_trivially_constructible.h b/libcxx/include/__type_traits/is_trivially_constructible.h --- a/libcxx/include/__type_traits/is_trivially_constructible.h +++ b/libcxx/include/__type_traits/is_trivially_constructible.h @@ -26,7 +26,7 @@ #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<_Tp, _Args...>::value; +inline constexpr bool is_trivially_constructible_v = __is_trivially_constructible(_Tp, _Args...); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_trivially_copy_assignable.h b/libcxx/include/__type_traits/is_trivially_copy_assignable.h --- a/libcxx/include/__type_traits/is_trivially_copy_assignable.h +++ b/libcxx/include/__type_traits/is_trivially_copy_assignable.h @@ -13,7 +13,6 @@ #include <__type_traits/add_const.h> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_trivially_assignable.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,9 +20,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable - : public is_trivially_assignable::type, - typename add_lvalue_reference::type>::type> {}; +template +struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable + : public integral_constant< + bool, + __is_trivially_assignable( + typename add_lvalue_reference<_Tp>::type, + typename add_lvalue_reference::type>::type)> {}; #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_trivially_copy_constructible.h b/libcxx/include/__type_traits/is_trivially_copy_constructible.h --- a/libcxx/include/__type_traits/is_trivially_copy_constructible.h +++ b/libcxx/include/__type_traits/is_trivially_copy_constructible.h @@ -12,7 +12,6 @@ #include <__config> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_trivially_constructible.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible - : public is_trivially_constructible<_Tp, typename add_lvalue_reference::type> + : public integral_constant::type)> {}; #if _LIBCPP_STD_VER > 14 diff --git a/libcxx/include/__type_traits/is_trivially_copyable.h b/libcxx/include/__type_traits/is_trivially_copyable.h --- a/libcxx/include/__type_traits/is_trivially_copyable.h +++ b/libcxx/include/__type_traits/is_trivially_copyable.h @@ -24,7 +24,7 @@ #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value; +inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_trivially_default_constructible.h b/libcxx/include/__type_traits/is_trivially_default_constructible.h --- a/libcxx/include/__type_traits/is_trivially_default_constructible.h +++ b/libcxx/include/__type_traits/is_trivially_default_constructible.h @@ -11,7 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_trivially_constructible.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,12 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructible - : public is_trivially_constructible<_Tp> + : public integral_constant {}; #if _LIBCPP_STD_VER > 14 template -inline constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible<_Tp>::value; +inline constexpr bool is_trivially_default_constructible_v = __is_trivially_constructible(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_trivially_destructible.h b/libcxx/include/__type_traits/is_trivially_destructible.h --- a/libcxx/include/__type_traits/is_trivially_destructible.h +++ b/libcxx/include/__type_traits/is_trivially_destructible.h @@ -18,29 +18,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_trivially_destructible) +#if __has_builtin(__is_trivially_destructible) template struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible : public integral_constant {}; -#elif __has_feature(has_trivial_destructor) || defined(_LIBCPP_COMPILER_GCC) +#elif __has_builtin(__has_trivial_destructor) template struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible : public integral_constant::value && __has_trivial_destructor(_Tp)> {}; #else -template struct __libcpp_trivial_destructor - : public integral_constant::value || - is_reference<_Tp>::value> {}; +#error is_trivially_destructible isn't implemented -template struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible - : public __libcpp_trivial_destructor::type> {}; - -template struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible<_Tp[]> - : public false_type {}; - -#endif +#endif // __has_builtin(__is_trivially_destructible) #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_trivially_move_assignable.h b/libcxx/include/__type_traits/is_trivially_move_assignable.h --- a/libcxx/include/__type_traits/is_trivially_move_assignable.h +++ b/libcxx/include/__type_traits/is_trivially_move_assignable.h @@ -13,7 +13,6 @@ #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/add_rvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_trivially_assignable.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,10 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable - : public is_trivially_assignable::type, - typename add_rvalue_reference<_Tp>::type> - {}; +template +struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable + : public integral_constant< + bool, + __is_trivially_assignable( + typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type)> {}; #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_trivially_move_constructible.h b/libcxx/include/__type_traits/is_trivially_move_constructible.h --- a/libcxx/include/__type_traits/is_trivially_move_constructible.h +++ b/libcxx/include/__type_traits/is_trivially_move_constructible.h @@ -12,7 +12,6 @@ #include <__config> #include <__type_traits/add_rvalue_reference.h> #include <__type_traits/integral_constant.h> -#include <__type_traits/is_trivially_constructible.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,9 +19,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible - : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> - {}; +template +struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible + : public integral_constant::type)> {}; #if _LIBCPP_STD_VER > 14 template diff --git a/libcxx/include/__type_traits/is_union.h b/libcxx/include/__type_traits/is_union.h --- a/libcxx/include/__type_traits/is_union.h +++ b/libcxx/include/__type_traits/is_union.h @@ -11,7 +11,6 @@ #include <__config> #include <__type_traits/integral_constant.h> -#include <__type_traits/remove_cv.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__type_traits/is_unsigned.h b/libcxx/include/__type_traits/is_unsigned.h --- a/libcxx/include/__type_traits/is_unsigned.h +++ b/libcxx/include/__type_traits/is_unsigned.h @@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // Before AppleClang 14, __is_unsigned returned true for enums with signed underlying type. -#if __has_keyword(__is_unsigned) && !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1400) +#if __has_builtin(__is_unsigned) && !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1400) template struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> { }; @@ -31,7 +31,7 @@ inline constexpr bool is_unsigned_v = __is_unsigned(_Tp); #endif -#else // __has_keyword(__is_unsigned) +#else // __has_builtin(__is_unsigned) template ::value> struct __libcpp_is_unsigned_impl : public _BoolConstant<(_Tp(0) < _Tp(-1))> {}; @@ -51,7 +51,7 @@ inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value; #endif -#endif // __has_keyword(__is_unsigned) +#endif // __has_builtin(__is_unsigned) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_void.h b/libcxx/include/__type_traits/is_void.h --- a/libcxx/include/__type_traits/is_void.h +++ b/libcxx/include/__type_traits/is_void.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_void) +#if __has_builtin(__is_void) template struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> { }; @@ -38,7 +38,7 @@ inline constexpr bool is_void_v = is_void<_Tp>::value; #endif -#endif // __has_keyword(__is_void) +#endif // __has_builtin(__is_void) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_volatile.h b/libcxx/include/__type_traits/is_volatile.h --- a/libcxx/include/__type_traits/is_volatile.h +++ b/libcxx/include/__type_traits/is_volatile.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_keyword(__is_volatile) +#if __has_builtin(__is_volatile) template struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> { }; @@ -38,7 +38,7 @@ inline constexpr bool is_volatile_v = is_volatile<_Tp>::value; #endif -#endif // __has_keyword(__is_volatile) +#endif // __has_builtin(__is_volatile) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/negation.h b/libcxx/include/__type_traits/negation.h --- a/libcxx/include/__type_traits/negation.h +++ b/libcxx/include/__type_traits/negation.h @@ -25,7 +25,7 @@ template struct negation : _Not<_Tp> {}; template -inline constexpr bool negation_v = negation<_Tp>::value; +inline constexpr bool negation_v = !_Tp::value; #endif // _LIBCPP_STD_VER > 14 _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/rank.h b/libcxx/include/__type_traits/rank.h --- a/libcxx/include/__type_traits/rank.h +++ b/libcxx/include/__type_traits/rank.h @@ -19,6 +19,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if __has_builtin(__array_rank) + +template +struct rank : integral_constant {}; + +#else + template struct _LIBCPP_TEMPLATE_VIS rank : public integral_constant {}; template struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]> @@ -26,6 +33,8 @@ template struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]> : public integral_constant::value + 1> {}; +#endif // __has_builtin(__array_rank) + #if _LIBCPP_STD_VER > 14 template inline constexpr size_t rank_v = rank<_Tp>::value;