From ac232a397a6842f4665e78ff64eead8265531742 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 24 Apr 2024 11:30:41 -0400 Subject: [PATCH] xo-unit: refactor: make natural_unit.reciprocal() a method --- include/xo/unit/natural_unit.hpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/xo/unit/natural_unit.hpp b/include/xo/unit/natural_unit.hpp index 33f7b84d..a62bd58d 100644 --- a/include/xo/unit/natural_unit.hpp +++ b/include/xo/unit/natural_unit.hpp @@ -13,6 +13,9 @@ namespace xo { namespace qty { using nu_abbrev_type = flatstring<32>; + template + class natural_unit; + /** @class natural_unit * @brief an array representing the cartesian product of distinct basis-power-units * @@ -37,6 +40,15 @@ namespace xo { constexpr bpu * bpu_v() const { return bpu_v_; } + constexpr natural_unit reciprocal() const { + natural_unit retval; + + for (std::size_t i = 0; i < this->n_bpu(); ++i) + retval.push_back((*this)[i].reciprocal()); + + return retval; + } + constexpr nu_abbrev_type abbrev() const { nu_abbrev_type retval; @@ -303,18 +315,6 @@ namespace xo { 1.0 /*outer_scale_sq*/); } - template - constexpr natural_unit - nu_reciprocal(const natural_unit & nu) - { - natural_unit retval; - - for (std::size_t i = 0; i < nu.n_bpu(); ++i) - retval.push_back(nu[i].reciprocal()); - - return retval; - } /*nunit_reciprocal*/ - } /*namespace detail*/ namespace nu2 {