From 390a0cee5dbc0b9354c2a63536049e8b3118bb09 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 8 Jul 2024 09:12:16 +0200 Subject: [PATCH] refactor: small refactoring of conditions in `convertible_impl` --- src/core/include/mp-units/framework/quantity_spec.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/include/mp-units/framework/quantity_spec.h b/src/core/include/mp-units/framework/quantity_spec.h index d769d04a..29be8c0c 100644 --- a/src/core/include/mp-units/framework/quantity_spec.h +++ b/src/core/include/mp-units/framework/quantity_spec.h @@ -1408,19 +1408,19 @@ template using enum specs_convertible_result; // NOLINTBEGIN(bugprone-branch-clone) - if constexpr (From::dimension != To::dimension) - return no; - else if constexpr (From{} == To{}) + if constexpr (From{} == To{}) return yes; + else if constexpr (From::dimension != To::dimension) + return no; else if constexpr (QuantityKindSpec || QuantityKindSpec) return convertible_kinds(get_kind_tree_root(from), get_kind_tree_root(to)); else if constexpr (NestedQuantityKindSpecOf && get_kind_tree_root(To{}) == To{}) return yes; - else if constexpr (NamedQuantitySpec && NamedQuantitySpec) { + else if constexpr (NamedQuantitySpec && NamedQuantitySpec) return convertible_named(from, to); - } else if constexpr (DerivedQuantitySpec && DerivedQuantitySpec) { + else if constexpr (DerivedQuantitySpec && DerivedQuantitySpec) return are_ingredients_convertible(from, to); - } else if constexpr (DerivedQuantitySpec) { + else if constexpr (DerivedQuantitySpec) { auto res = explode(from); if constexpr (NamedQuantitySpec) return convertible_impl(res.quantity, to);