From 9db5e4df22d47ea6741913b5ca618687133494fe Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 26 Apr 2025 08:17:05 -0700 Subject: [PATCH] Don't specialize std::is_floating_point --- include/fmt/format.h | 11 +++++------ test/format-impl-test.cc | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 2596e3a8..b2fdd3d6 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -721,11 +721,10 @@ struct float128 {}; template using is_float128 = std::is_same; -template -using is_floating_point = - bool_constant::value || is_float128::value>; +template struct is_floating_point : std::is_floating_point {}; +template <> struct is_floating_point : std::true_type {}; -template ::value> +template ::value> struct is_fast_float : bool_constant::is_iec559 && sizeof(T) <= sizeof(double)> {}; template struct is_fast_float : std::false_type {}; @@ -2472,8 +2471,8 @@ template struct has_isfinite> : std::true_type {}; -template ::value&& - has_isfinite::value)> +template ::value&& has_isfinite::value)> FMT_CONSTEXPR20 auto isfinite(T value) -> bool { constexpr T inf = T(std::numeric_limits::infinity()); if (is_constant_evaluated()) diff --git a/test/format-impl-test.cc b/test/format-impl-test.cc index 4ebf2a6e..2be15d00 100644 --- a/test/format-impl-test.cc +++ b/test/format-impl-test.cc @@ -307,7 +307,6 @@ struct slow_float { auto format_as(slow_float f) -> float { return f; } namespace std { -template <> struct is_floating_point : std::true_type {}; template <> struct numeric_limits { // is_iec559 is true for double-double in libstdc++. static constexpr bool is_iec559 = true; @@ -315,12 +314,13 @@ template <> struct numeric_limits { static constexpr int digits10 = 33; }; -template <> struct is_floating_point : std::true_type {}; template <> struct numeric_limits : numeric_limits {}; } // namespace std FMT_BEGIN_NAMESPACE namespace detail { +template <> struct is_floating_point : std::true_type {}; +template <> struct is_floating_point : std::true_type {}; template <> struct is_fast_float : std::false_type {}; namespace dragonbox { template <> struct float_info {