diff --git a/src/core/include/mp-units/framework/quantity_spec.h b/src/core/include/mp-units/framework/quantity_spec.h index c2c7fb8d..89eae99e 100644 --- a/src/core/include/mp-units/framework/quantity_spec.h +++ b/src/core/include/mp-units/framework/quantity_spec.h @@ -120,10 +120,34 @@ template template [[nodiscard]] consteval auto remove_kind(Q q); +struct quantity_spec_interface_base { + template + [[nodiscard]] friend consteval QuantitySpec auto operator*(Lhs lhs, Rhs rhs) + { + return clone_kind_of( + expr_multiply(remove_kind(lhs), + remove_kind(rhs))); + } + + template + [[nodiscard]] friend consteval QuantitySpec auto operator/(Lhs lhs, Rhs rhs) + { + return clone_kind_of( + expr_divide(remove_kind(lhs), + remove_kind(rhs))); + } + + template + [[nodiscard]] friend consteval bool operator==(Lhs, Rhs) + { + return is_same_v; + } +}; + #if !MP_UNITS_API_NO_CRTP template #endif -struct quantity_spec_interface { +struct quantity_spec_interface : quantity_spec_interface_base { #if MP_UNITS_API_NO_CRTP template U> [[nodiscard]] consteval Reference auto operator[](this Self self, U u) @@ -155,28 +179,6 @@ struct quantity_spec_interface { make_reference(Self{}, std::remove_cvref_t::unit)}; } #endif - - template - [[nodiscard]] friend consteval QuantitySpec auto operator*(Lhs lhs, Rhs rhs) - { - return clone_kind_of( - expr_multiply(remove_kind(lhs), - remove_kind(rhs))); - } - - template - [[nodiscard]] friend consteval QuantitySpec auto operator/(Lhs lhs, Rhs rhs) - { - return clone_kind_of( - expr_divide(remove_kind(lhs), - remove_kind(rhs))); - } - - template - [[nodiscard]] friend consteval bool operator==(Lhs, Rhs) - { - return is_same_v; - } }; } // namespace detail diff --git a/src/core/include/mp-units/framework/quantity_spec_concepts.h b/src/core/include/mp-units/framework/quantity_spec_concepts.h index af939c59..9eac9f2d 100644 --- a/src/core/include/mp-units/framework/quantity_spec_concepts.h +++ b/src/core/include/mp-units/framework/quantity_spec_concepts.h @@ -30,30 +30,14 @@ namespace mp_units { -#if MP_UNITS_API_NO_CRTP - namespace detail { -struct quantity_spec_interface; +struct quantity_spec_interface_base; } MP_UNITS_EXPORT template -concept QuantitySpec = std::derived_from && std::is_final_v; - -#else - -namespace detail { - -template -struct quantity_spec_interface; - -} - -MP_UNITS_EXPORT template -concept QuantitySpec = is_derived_from_specialization_of && std::is_final_v; - -#endif +concept QuantitySpec = std::derived_from && std::is_final_v; MP_UNITS_EXPORT #if MP_UNITS_API_NO_CRTP