diff --git a/include/xo/unit/xquantity.hpp b/include/xo/unit/xquantity.hpp index 92e31a89..3aec78c2 100644 --- a/include/xo/unit/xquantity.hpp +++ b/include/xo/unit/xquantity.hpp @@ -341,6 +341,26 @@ namespace xo { return Quantity::subtract(x, y); } + /** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr) + **/ + template + requires quantity2_concept + constexpr auto + operator- (const Quantity & x, double y) + { + return x - Quantity(y, nu::dimensionless); + } + + /** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr) + **/ + template + requires quantity2_concept + constexpr auto + operator- (double x, const Quantity & y) + { + return Quantity(x, nu::dimensionless) - y; + } + /** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr) **/ template