From 4d092dcbc213452ad5acee98d7cf37fb475a6349 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 24 Apr 2024 11:31:33 -0400 Subject: [PATCH] xo-unit: + Quantity.scale_by() --- include/xo/unit/Quantity.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/xo/unit/Quantity.hpp b/include/xo/unit/Quantity.hpp index a70fcdee..a401fc9f 100644 --- a/include/xo/unit/Quantity.hpp +++ b/include/xo/unit/Quantity.hpp @@ -60,6 +60,12 @@ namespace xo { } } + template + requires std::is_arithmetic_v + constexpr auto scale_by(Dimensionless x) const { + return Quantity(x * this->scale_, this->unit_); + } + template static constexpr auto multiply(const Quantity & x, const Quantity2 & y) {