mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-02 11:54:27 +02:00
fix: op%
fixed for the same argument types case
This commit is contained in:
@@ -367,11 +367,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] friend constexpr Quantity auto operator%(const quantity& lhs, const quantity& rhs)
|
[[nodiscard]] friend constexpr Quantity auto operator%(const quantity& lhs, const quantity& rhs)
|
||||||
requires (!floating_point_<rep>) && is_same_v<unit, units::one> &&
|
requires (!floating_point_<rep>) &&
|
||||||
invoke_result_convertible_to_<rep, std::modulus<>, rep, rep>
|
invoke_result_convertible_to_<rep, std::modulus<>, rep, rep>
|
||||||
{
|
{
|
||||||
gsl_ExpectsAudit(rhs.number() != quantity_values<rep>::zero());
|
gsl_ExpectsAudit(rhs.number() != quantity_values<rep>::zero());
|
||||||
return units::quantity(lhs.number() % rhs.number());
|
using ret = quantity<D, U, std::invoke_result_t<std::modulus<>, rep, rep>>;
|
||||||
|
return ret(lhs.number() % rhs.number());
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] friend constexpr auto operator<=>(const quantity& lhs, const quantity& rhs)
|
[[nodiscard]] friend constexpr auto operator<=>(const quantity& lhs, const quantity& rhs)
|
||||||
|
Reference in New Issue
Block a user