From 85403895304f30cd5a6e0e994a1e4810b52aa799 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 11 May 2021 19:36:07 +0200 Subject: [PATCH] fix: `op%` fixed for the same argument types case --- src/core/include/units/quantity.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/include/units/quantity.h b/src/core/include/units/quantity.h index c40b9992..03140500 100644 --- a/src/core/include/units/quantity.h +++ b/src/core/include/units/quantity.h @@ -367,11 +367,12 @@ public: } [[nodiscard]] friend constexpr Quantity auto operator%(const quantity& lhs, const quantity& rhs) - requires (!floating_point_) && is_same_v && + requires (!floating_point_) && invoke_result_convertible_to_, rep, rep> { gsl_ExpectsAudit(rhs.number() != quantity_values::zero()); - return units::quantity(lhs.number() % rhs.number()); + using ret = quantity, rep, rep>>; + return ret(lhs.number() % rhs.number()); } [[nodiscard]] friend constexpr auto operator<=>(const quantity& lhs, const quantity& rhs)