From b7e2033d33fa42843de38cfc6d0f2a4875caff4b Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 9 Oct 2023 12:07:09 -0600 Subject: [PATCH] refactor: dead code case for units ordering removed --- src/core/include/mp-units/unit.h | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/core/include/mp-units/unit.h b/src/core/include/mp-units/unit.h index 50c38a2c..9c1115fe 100644 --- a/src/core/include/mp-units/unit.h +++ b/src/core/include/mp-units/unit.h @@ -370,25 +370,7 @@ template [[nodiscard]] consteval auto get_canonical_unit(Unit auto u) { return get_canonical_unit_impl(u, u); } template -[[nodiscard]] consteval bool less(Lhs, Rhs) -{ - if constexpr (requires { - Lhs::symbol; - Rhs::symbol; - }) - // prefer symbols comparison if possible as it gives typically better results - // i.e. it puts upper case in from so `N m` is correct - return Lhs::symbol < Rhs::symbol; - else - return type_name() < type_name(); -} - - -// TODO What if the same unit will have different types (i.e. user will inherit its own type from `metre`)? -// Is there a better way to sort units here? Some of them may not have symbol at all (like all units of -// dimensionless quantities). -template -struct unit_less : std::bool_constant {}; +struct unit_less : std::bool_constant<(Lhs::symbol < Rhs::symbol)> {}; template using type_list_of_unit_less = expr_less;