From ea660188d85d6c7feaa9dad9ddc75e37194f52ed Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Sat, 8 Nov 2025 14:41:07 +0100 Subject: [PATCH] [libc++] Use variable templates in is_floating_point --- libcxx/include/__type_traits/is_floating_point.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libcxx/include/__type_traits/is_floating_point.h b/libcxx/include/__type_traits/is_floating_point.h index b87363fe5b357..17e6e0281a687 100644 --- a/libcxx/include/__type_traits/is_floating_point.h +++ b/libcxx/include/__type_traits/is_floating_point.h @@ -20,18 +20,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD // clang-format off -template struct __libcpp_is_floating_point : false_type {}; -template <> struct __libcpp_is_floating_point : true_type {}; -template <> struct __libcpp_is_floating_point : true_type {}; -template <> struct __libcpp_is_floating_point : true_type {}; +template inline const bool __is_floating_point_impl = false; +template <> inline const bool __is_floating_point_impl = true; +template <> inline const bool __is_floating_point_impl = true; +template <> inline const bool __is_floating_point_impl = true; // clang-format on template -struct _LIBCPP_NO_SPECIALIZATIONS is_floating_point : __libcpp_is_floating_point<__remove_cv_t<_Tp> > {}; +struct _LIBCPP_NO_SPECIALIZATIONS is_floating_point + : integral_constant > > {}; #if _LIBCPP_STD_VER >= 17 -template -_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; +template +inline constexpr bool is_floating_point_v = __is_floating_point_impl<__remove_cv_t<_Tp>>; #endif _LIBCPP_END_NAMESPACE_STD