forked from mpusz/mp-units
refactor: small refactoring of conditions in convertible_impl
This commit is contained in:
@@ -1408,19 +1408,19 @@ template<QuantitySpec From, QuantitySpec To>
|
|||||||
using enum specs_convertible_result;
|
using enum specs_convertible_result;
|
||||||
|
|
||||||
// NOLINTBEGIN(bugprone-branch-clone)
|
// NOLINTBEGIN(bugprone-branch-clone)
|
||||||
if constexpr (From::dimension != To::dimension)
|
if constexpr (From{} == To{})
|
||||||
return no;
|
|
||||||
else if constexpr (From{} == To{})
|
|
||||||
return yes;
|
return yes;
|
||||||
|
else if constexpr (From::dimension != To::dimension)
|
||||||
|
return no;
|
||||||
else if constexpr (QuantityKindSpec<From> || QuantityKindSpec<To>)
|
else if constexpr (QuantityKindSpec<From> || QuantityKindSpec<To>)
|
||||||
return convertible_kinds(get_kind_tree_root(from), get_kind_tree_root(to));
|
return convertible_kinds(get_kind_tree_root(from), get_kind_tree_root(to));
|
||||||
else if constexpr (NestedQuantityKindSpecOf<get_kind_tree_root(To{}), from> && get_kind_tree_root(To{}) == To{})
|
else if constexpr (NestedQuantityKindSpecOf<get_kind_tree_root(To{}), from> && get_kind_tree_root(To{}) == To{})
|
||||||
return yes;
|
return yes;
|
||||||
else if constexpr (NamedQuantitySpec<From> && NamedQuantitySpec<To>) {
|
else if constexpr (NamedQuantitySpec<From> && NamedQuantitySpec<To>)
|
||||||
return convertible_named(from, to);
|
return convertible_named(from, to);
|
||||||
} else if constexpr (DerivedQuantitySpec<From> && DerivedQuantitySpec<To>) {
|
else if constexpr (DerivedQuantitySpec<From> && DerivedQuantitySpec<To>)
|
||||||
return are_ingredients_convertible(from, to);
|
return are_ingredients_convertible(from, to);
|
||||||
} else if constexpr (DerivedQuantitySpec<From>) {
|
else if constexpr (DerivedQuantitySpec<From>) {
|
||||||
auto res = explode<get_complexity(to)>(from);
|
auto res = explode<get_complexity(to)>(from);
|
||||||
if constexpr (NamedQuantitySpec<decltype(res.quantity)>)
|
if constexpr (NamedQuantitySpec<decltype(res.quantity)>)
|
||||||
return convertible_impl(res.quantity, to);
|
return convertible_impl(res.quantity, to);
|
||||||
|
Reference in New Issue
Block a user