From 79ef21b2a5c432031d854a6f3f54bda7c3211e9a Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 22 Sep 2022 10:23:41 +0200 Subject: [PATCH] refactor: `power::ratio` renamed to `power::exponent` --- src/core/include/units/bits/expression_template.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/core/include/units/bits/expression_template.h b/src/core/include/units/bits/expression_template.h index e911428d..089cf147 100644 --- a/src/core/include/units/bits/expression_template.h +++ b/src/core/include/units/bits/expression_template.h @@ -37,11 +37,9 @@ struct per {}; template struct power { using factor = F; - static constexpr ::units::ratio ratio{Num, Den...}; + static constexpr ratio exponent{Num, Den...}; }; -// TODO make_power() that will simplify cases like ? - namespace detail { template @@ -55,7 +53,7 @@ inline constexpr bool is_specialization_of_power> = true; namespace detail { template -// template // TODO +// template // TODO consteval auto power_or_T_impl() { if constexpr (R.den == 1) { @@ -132,12 +130,12 @@ struct expr_consolidate_impl> { template struct expr_consolidate_impl, Rest...>> { - using type = expr_consolidate_impl::ratio + 1>, Rest...>>::type; + using type = expr_consolidate_impl::exponent + 1>, Rest...>>::type; }; template struct expr_consolidate_impl, power, Rest...>> { - static constexpr ratio r = power::ratio + power::ratio; + static constexpr ratio r = power::exponent + power::exponent; using type = conditional>::type, typename expr_consolidate_impl, Rest...>>::type>; }; @@ -150,7 +148,7 @@ using expr_consolidate = typename expr_consolidate_impl::type; template struct expr_simplify_power { - static constexpr ratio r = powerNum::ratio - powerDen::ratio; + static constexpr ratio r = powerNum::exponent - powerDen::exponent; using type = power_or_T; using num = conditional<(r > 0), type_list, type_list<>>; using den = conditional<(r < 0), type_list, type_list<>>;