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;