xo-unit: + Quantity.add support

This commit is contained in:
Roland Conybeare 2024-04-23 15:36:11 -04:00
commit e1d7f62ca6
6 changed files with 120 additions and 13 deletions

View file

@ -102,6 +102,13 @@ namespace xo {
return bpu<Int>(native_dim(), scalefactor(), power_.negate());
}
template <typename Int2>
constexpr bpu<Int2> to_repr() const {
return bpu<Int2>(this->native_dim(),
this->scalefactor(),
ratio::ratio<Int2>(power_.num(), power_.den()));
}
/** @brief this unit represents native dimension taken to this power **/
power_ratio_type power_;
};