From 7615de4720352bd89da164bb5b04d7c0d437e2be Mon Sep 17 00:00:00 2001 From: Chip Hogg Date: Sun, 6 Feb 2022 21:06:53 +0000 Subject: [PATCH] See if passing by const& will satisfy all compilers The only reason we had the `is_magnitude_integral` type members before is because the compiler complained about incomplete types. Passing by `const&` might eliminate this need. --- src/core/include/units/magnitude.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/include/units/magnitude.h b/src/core/include/units/magnitude.h index 9c57baa8..dfd9632a 100644 --- a/src/core/include/units/magnitude.h +++ b/src/core/include/units/magnitude.h @@ -327,12 +327,10 @@ template requires (detail::is_base_power_pack_valid) struct magnitude { // Whether this magnitude represents an integer. - static constexpr bool is_magnitude_integral = (detail::is_integral(BPs) && ...); - friend constexpr bool is_integral(magnitude) { return is_magnitude_integral; } + friend constexpr bool is_integral(const magnitude&) { return (detail::is_integral(BPs) && ...); } // Whether this magnitude represents a rational number. - static constexpr bool is_magnitude_rational = (detail::is_rational(BPs) && ...); - friend constexpr bool is_rational(magnitude) { return is_magnitude_rational; } + friend constexpr bool is_rational(const magnitude&) { return (detail::is_rational(BPs) && ...); } // The value of this magnitude, expressed in a given type. template @@ -363,7 +361,7 @@ concept Magnitude = detail::is_magnitude; * Can avoid the need for an unsightly `.template` keyword. */ template -T get_value(Magnitude auto m) { return decltype(m)::template value; } +constexpr T get_value(Magnitude auto m) { return decltype(m)::template value; } /** * @brief A base to represent pi.