mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 10:27:16 +02:00
fix: quantity_spec_interface_base
introduced to fix the compilation on the older compilers
This commit is contained in:
@ -120,10 +120,34 @@ template<QuantitySpec auto... From, QuantitySpec Q>
|
||||
template<QuantitySpec Q>
|
||||
[[nodiscard]] consteval auto remove_kind(Q q);
|
||||
|
||||
struct quantity_spec_interface_base {
|
||||
template<QuantitySpec Lhs, QuantitySpec Rhs>
|
||||
[[nodiscard]] friend consteval QuantitySpec auto operator*(Lhs lhs, Rhs rhs)
|
||||
{
|
||||
return clone_kind_of<Lhs{}, Rhs{}>(
|
||||
expr_multiply<derived_quantity_spec, struct dimensionless, type_list_of_quantity_spec_less>(remove_kind(lhs),
|
||||
remove_kind(rhs)));
|
||||
}
|
||||
|
||||
template<QuantitySpec Lhs, QuantitySpec Rhs>
|
||||
[[nodiscard]] friend consteval QuantitySpec auto operator/(Lhs lhs, Rhs rhs)
|
||||
{
|
||||
return clone_kind_of<Lhs{}, Rhs{}>(
|
||||
expr_divide<derived_quantity_spec, struct dimensionless, type_list_of_quantity_spec_less>(remove_kind(lhs),
|
||||
remove_kind(rhs)));
|
||||
}
|
||||
|
||||
template<QuantitySpec Lhs, QuantitySpec Rhs>
|
||||
[[nodiscard]] friend consteval bool operator==(Lhs, Rhs)
|
||||
{
|
||||
return is_same_v<Lhs, Rhs>;
|
||||
}
|
||||
};
|
||||
|
||||
#if !MP_UNITS_API_NO_CRTP
|
||||
template<typename Self>
|
||||
#endif
|
||||
struct quantity_spec_interface {
|
||||
struct quantity_spec_interface : quantity_spec_interface_base {
|
||||
#if MP_UNITS_API_NO_CRTP
|
||||
template<typename Self, UnitOf<Self{}> 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<Q>::unit)};
|
||||
}
|
||||
#endif
|
||||
|
||||
template<QuantitySpec Lhs, QuantitySpec Rhs>
|
||||
[[nodiscard]] friend consteval QuantitySpec auto operator*(Lhs lhs, Rhs rhs)
|
||||
{
|
||||
return clone_kind_of<Lhs{}, Rhs{}>(
|
||||
expr_multiply<derived_quantity_spec, struct dimensionless, type_list_of_quantity_spec_less>(remove_kind(lhs),
|
||||
remove_kind(rhs)));
|
||||
}
|
||||
|
||||
template<QuantitySpec Lhs, QuantitySpec Rhs>
|
||||
[[nodiscard]] friend consteval QuantitySpec auto operator/(Lhs lhs, Rhs rhs)
|
||||
{
|
||||
return clone_kind_of<Lhs{}, Rhs{}>(
|
||||
expr_divide<derived_quantity_spec, struct dimensionless, type_list_of_quantity_spec_less>(remove_kind(lhs),
|
||||
remove_kind(rhs)));
|
||||
}
|
||||
|
||||
template<QuantitySpec Lhs, QuantitySpec Rhs>
|
||||
[[nodiscard]] friend consteval bool operator==(Lhs, Rhs)
|
||||
{
|
||||
return is_same_v<Lhs, Rhs>;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
@ -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<typename T>
|
||||
concept QuantitySpec = std::derived_from<T, detail::quantity_spec_interface> && std::is_final_v<T>;
|
||||
|
||||
#else
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename Self>
|
||||
struct quantity_spec_interface;
|
||||
|
||||
}
|
||||
|
||||
MP_UNITS_EXPORT template<typename T>
|
||||
concept QuantitySpec = is_derived_from_specialization_of<T, detail::quantity_spec_interface> && std::is_final_v<T>;
|
||||
|
||||
#endif
|
||||
concept QuantitySpec = std::derived_from<T, detail::quantity_spec_interface_base> && std::is_final_v<T>;
|
||||
|
||||
MP_UNITS_EXPORT
|
||||
#if MP_UNITS_API_NO_CRTP
|
||||
|
Reference in New Issue
Block a user