diff --git a/include/xo/unit/Quantity.hpp b/include/xo/unit/Quantity.hpp index 3dd82eaf..aaf29d73 100644 --- a/include/xo/unit/Quantity.hpp +++ b/include/xo/unit/Quantity.hpp @@ -94,7 +94,7 @@ namespace xo { * static_cast(y.scale())); return Quantity(r_scale, - rr.natural_unit_); + rr.natural_unit_); } template @@ -169,6 +169,14 @@ namespace xo { } } + template + static constexpr + auto compare(const Quantity & x, const Quantity2 & y) { + Quantity y2 = y.rescale(x.unit_); + + return x.scale() <=> y2.scale(); + } + private: /** @brief quantity represents this multiple of a unit amount **/ Repr scale_ = Repr{};