From bb5fc1cb4e5e4bbfc3b71a75d23a65fb2be93dfa Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 3 Apr 2024 17:23:56 -0400 Subject: [PATCH] xo-unit: quantity: + with_unit() + with_repr() convenience --- 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 9a86baba..38fa44d8 100644 --- a/include/xo/unit/quantity.hpp +++ b/include/xo/unit/quantity.hpp @@ -77,6 +77,12 @@ namespace xo { return promoter::promote(x); } + template + constexpr quantity with_unit() const { return *this; } + + template + constexpr quantity with_repr() const { return quantity::promote(scale_); } + template auto multiply(Quantity2 y) const { //constexpr bool c_debug_flag = false;