diff --git a/src/core/include/mp-units/bits/get_associated_quantity.h b/src/core/include/mp-units/bits/get_associated_quantity.h index d3783b18..d976b17e 100644 --- a/src/core/include/mp-units/bits/get_associated_quantity.h +++ b/src/core/include/mp-units/bits/get_associated_quantity.h @@ -76,9 +76,9 @@ template template [[nodiscard]] consteval auto get_associated_quantity(U u) { - constexpr bool all_kinds = all_are_kinds(MP_UNITS_IS_CONST_EXPR_WORKAROUND(u)); + constexpr bool all_kinds = all_are_kinds(U{}); if constexpr (all_kinds) - return kind_of; + return kind_of; else return get_associated_quantity_impl(u); } diff --git a/src/core/include/mp-units/bits/hacks.h b/src/core/include/mp-units/bits/hacks.h index 4aec2a8d..8ec54946 100644 --- a/src/core/include/mp-units/bits/hacks.h +++ b/src/core/include/mp-units/bits/hacks.h @@ -118,15 +118,12 @@ inline constexpr from_range_t from_range{}; #define MP_UNITS_CONSTRAINED_NTTP_WORKAROUND(X) #define MP_UNITS_EXPRESSION_WORKAROUND(x) (x) #define MP_UNITS_IS_VALUE_WORKAROUND(x) (x) -#define MP_UNITS_IS_CONST_EXPR_WORKAROUND(x) \ - decltype(x) {} #else #define MP_UNITS_CONSTRAINED_NTTP_WORKAROUND(X) X #define MP_UNITS_EXPRESSION_WORKAROUND(x) x #define MP_UNITS_IS_VALUE_WORKAROUND(x) x -#define MP_UNITS_IS_CONST_EXPR_WORKAROUND(x) x #endif diff --git a/src/core/include/mp-units/framework/quantity_spec.h b/src/core/include/mp-units/framework/quantity_spec.h index 6a0bdc2a..6a3be2ff 100644 --- a/src/core/include/mp-units/framework/quantity_spec.h +++ b/src/core/include/mp-units/framework/quantity_spec.h @@ -1345,14 +1345,10 @@ template return convertible_impl(from_kind, to_kind); else if constexpr (get_complexity(From{}) > get_complexity(To{})) return exploded_kind_result(convertible_impl( - get_kind_tree_root( - explode(from_kind).quantity), - to_kind)); + get_kind_tree_root(explode(from_kind).quantity),to_kind)); else - return exploded_kind_result(convertible_impl( - from_kind, - get_kind_tree_root( - explode(to_kind).quantity))); + return exploded_kind_result( + convertible_impl(from_kind,get_kind_tree_root(explode(to_kind).quantity))); } template @@ -1369,11 +1365,9 @@ template return no; else if constexpr (get_complexity(From{}) != get_complexity(To{})) { if constexpr (get_complexity(From{}) > get_complexity(To{})) - return convertible_impl( - explode(from).quantity, - to); + return convertible_impl(explode(from).quantity,to); else { - auto res = explode(to); + auto res = explode(to); return min(res.result, convertible_impl(from, res.quantity)); } } @@ -1398,7 +1392,7 @@ template else if constexpr (DerivedQuantitySpec && DerivedQuantitySpec) return are_ingredients_convertible(from, to); else if constexpr (DerivedQuantitySpec) { - auto res = explode(from); + auto res = explode(from); if constexpr (NamedQuantitySpec) return convertible_impl(res.quantity, to); else if constexpr (requires { to._equation_; }) { @@ -1407,7 +1401,7 @@ template } else return are_ingredients_convertible(from, to); } else if constexpr (DerivedQuantitySpec) { - auto res = explode(to); + auto res = explode(to); if constexpr (NamedQuantitySpec) return min(res.result, convertible_impl(from, res.quantity)); else if constexpr (requires { from._equation_; }) @@ -1498,9 +1492,9 @@ template MP_UNITS_EXPORT_BEGIN template -[[nodiscard]] consteval detail::QuantityKindSpec auto get_kind(Q q) +[[nodiscard]] consteval detail::QuantityKindSpec auto get_kind(Q) { - return kind_of; + return kind_of; } [[nodiscard]] consteval QuantitySpec auto common_quantity_spec(QuantitySpec auto q) { return q; } diff --git a/src/core/include/mp-units/framework/reference.h b/src/core/include/mp-units/framework/reference.h index 5a5f8262..a708d214 100644 --- a/src/core/include/mp-units/framework/reference.h +++ b/src/core/include/mp-units/framework/reference.h @@ -292,9 +292,9 @@ template } { return detail::reference_t< - common_quantity_spec(get_quantity_spec(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r1)), get_quantity_spec(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r2)), + common_quantity_spec(get_quantity_spec(R1{}), get_quantity_spec(R2{}), get_quantity_spec(rest)...), - common_unit(get_unit(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r1)), get_unit(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r2)), get_unit(rest)...)>{}; + common_unit(get_unit(R1{}), get_unit(R2{}), get_unit(rest)...)>{}; } MP_UNITS_EXPORT_END