xo-unit: refactor: make natural_unit.reciprocal() a method
This commit is contained in:
parent
eb36c44613
commit
ac232a397a
1 changed files with 12 additions and 12 deletions
|
|
@ -13,6 +13,9 @@ namespace xo {
|
|||
namespace qty {
|
||||
using nu_abbrev_type = flatstring<32>;
|
||||
|
||||
template <typename Int>
|
||||
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<Int> * 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 <typename Int>
|
||||
constexpr natural_unit<Int>
|
||||
nu_reciprocal(const natural_unit<Int> & nu)
|
||||
{
|
||||
natural_unit<Int> 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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue