From 8d24b47948a3802d4f81d6b7bbcd25757cd9872d Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Sat, 26 Oct 2024 19:06:14 +0200 Subject: [PATCH] refactor: `treat_as_floating_point` simplified and extended to use `std::chrono::treat_as_floating_point_v` --- src/core/include/mp-units/bits/core_gmf.h | 1 + .../mp-units/framework/customization_points.h | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/core/include/mp-units/bits/core_gmf.h b/src/core/include/mp-units/bits/core_gmf.h index f5392c21..5566bc92 100644 --- a/src/core/include/mp-units/bits/core_gmf.h +++ b/src/core/include/mp-units/bits/core_gmf.h @@ -55,6 +55,7 @@ #if MP_UNITS_HOSTED #include #ifndef MP_UNITS_IMPORT_STD +#include #include #include #include diff --git a/src/core/include/mp-units/framework/customization_points.h b/src/core/include/mp-units/framework/customization_points.h index 6b40e833..43ca0201 100644 --- a/src/core/include/mp-units/framework/customization_points.h +++ b/src/core/include/mp-units/framework/customization_points.h @@ -33,6 +33,9 @@ import std; #include #include #include +#if MP_UNITS_HOSTED +#include +#endif #endif #endif @@ -50,11 +53,12 @@ MP_UNITS_EXPORT_BEGIN * @tparam Rep a representation type for which a type trait is defined */ template -constexpr bool treat_as_floating_point = std::is_floating_point_v; - -template - requires requires { typename wrapped_type_t; } -constexpr bool treat_as_floating_point = treat_as_floating_point>; +constexpr bool treat_as_floating_point = +#if MP_UNITS_HOSTED + std::chrono::treat_as_floating_point_v>; +#else + std::is_floating_point_v>; +#endif /** * @brief Specifies a type to have a scalar character