diff --git a/src/core/include/mp-units/framework/quantity_concepts.h b/src/core/include/mp-units/framework/quantity_concepts.h index 6886b8a9..37929f19 100644 --- a/src/core/include/mp-units/framework/quantity_concepts.h +++ b/src/core/include/mp-units/framework/quantity_concepts.h @@ -41,7 +41,7 @@ void to_base_specialization_of_quantity(const volatile quantity*); template inline constexpr bool is_derived_from_specialization_of_quantity = - requires(std::remove_reference_t* t) { to_base_specialization_of_quantity(t); }; + requires(T* t) { to_base_specialization_of_quantity(t); }; } // namespace detail diff --git a/src/core/include/mp-units/framework/quantity_spec.h b/src/core/include/mp-units/framework/quantity_spec.h index 3ec46f40..1d16b67e 100644 --- a/src/core/include/mp-units/framework/quantity_spec.h +++ b/src/core/include/mp-units/framework/quantity_spec.h @@ -915,12 +915,11 @@ template return extract_results{false}; else if constexpr (from_exp > to_exp) return extract_results{true, pow(from_factor), pow(to_factor), - prepend_rest::first, - power_or_T, from_exp - to_exp>{}}; + prepend_rest::first, power_or_T{}}; else return extract_results{true, pow(from_factor), pow(to_factor), prepend_rest::second, - power_or_T, to_exp - from_exp>{}}; + power_or_T{}}; } } @@ -934,7 +933,7 @@ template; + using elem = decltype(Ext.elem); if constexpr (Entities == process_entities::numerators) { if constexpr (Ext.prepend == prepend_rest::first) return min(res, are_ingredients_convertible(type_list_push_front{}, den_from, num_to, den_to)); @@ -959,7 +958,7 @@ template; + using elem = decltype(Ext.elem); if constexpr (Entities == process_entities::from) { if constexpr (Ext.prepend == prepend_rest::first) return are_ingredients_convertible(type_list_push_front{}, den_from, num_to, den_to); @@ -1342,8 +1341,7 @@ template using enum specs_convertible_result; return res == no ? no : yes; }; - if constexpr ((NamedQuantitySpec> && - NamedQuantitySpec>) || + if constexpr ((NamedQuantitySpec && NamedQuantitySpec) || get_complexity(from_kind) == get_complexity(to_kind)) return convertible_impl(from_kind, to_kind); else if constexpr (get_complexity(from_kind) > get_complexity(to_kind)) diff --git a/src/core/include/mp-units/framework/quantity_spec_concepts.h b/src/core/include/mp-units/framework/quantity_spec_concepts.h index 2887ae5e..ab5b047d 100644 --- a/src/core/include/mp-units/framework/quantity_spec_concepts.h +++ b/src/core/include/mp-units/framework/quantity_spec_concepts.h @@ -140,9 +140,8 @@ namespace detail { template concept NestedQuantityKindSpecOf = - QuantitySpec && QuantitySpec && - get_kind(From) != get_kind(To) && - std::derived_from, std::remove_cvref_t>; + QuantitySpec && QuantitySpec && get_kind(From) != get_kind(To) && + std::derived_from>; } diff --git a/src/core/include/mp-units/framework/unit.h b/src/core/include/mp-units/framework/unit.h index c00952ff..03dde4f0 100644 --- a/src/core/include/mp-units/framework/unit.h +++ b/src/core/include/mp-units/framework/unit.h @@ -432,9 +432,9 @@ MP_UNITS_EXPORT_BEGIN * Multiplication by `1` returns the same unit, otherwise `scaled_unit` is being returned. */ template -[[nodiscard]] MP_UNITS_CONSTEVAL Unit auto operator*(M, const U u) +[[nodiscard]] MP_UNITS_CONSTEVAL Unit auto operator*(M, U u) { - if constexpr (std::is_same_v)>>) + if constexpr (std::is_same_v)>>) return u; else return scaled_unit{}; @@ -446,7 +446,7 @@ template * Returns the result of multiplication with an inverse unit. */ template -[[nodiscard]] MP_UNITS_CONSTEVAL Unit auto operator/(M mag, const U u) +[[nodiscard]] MP_UNITS_CONSTEVAL Unit auto operator/(M mag, U u) { return mag * inverse(u); } diff --git a/test/static/custom_rep_test_min_impl.cpp b/test/static/custom_rep_test_min_impl.cpp index a473f276..96be3598 100644 --- a/test/static/custom_rep_test_min_impl.cpp +++ b/test/static/custom_rep_test_min_impl.cpp @@ -82,7 +82,7 @@ static_assert(!std::convertible_to, quantity -concept creates_quantity = Unit> && requires { T{} * U; }; +concept creates_quantity = Unit && requires { T{} * U; }; static_assert(creates_quantity, si::metre>); static_assert(creates_quantity, si::metre>); diff --git a/test/static/magnitude_test.cpp b/test/static/magnitude_test.cpp index af739aff..f245b0b8 100644 --- a/test/static/magnitude_test.cpp +++ b/test/static/magnitude_test.cpp @@ -83,7 +83,7 @@ static_assert(Magnitude)>); static_assert(Magnitude); // is_named_magnitude -static_assert(!is_named_magnitude)>>); +static_assert(!is_named_magnitude)>); static_assert(is_named_magnitude); // power_v diff --git a/test/static/test_tools.h b/test/static/test_tools.h index 051fc31c..bb98deb8 100644 --- a/test/static/test_tools.h +++ b/test/static/test_tools.h @@ -27,7 +27,7 @@ #include template -inline constexpr bool is_of_type = std::is_same_v, T>; +inline constexpr bool is_of_type = std::is_same_v; // NOLINTBEGIN(cppcoreguidelines-macro-usage) #ifdef MP_UNITS_API_NO_CRTP diff --git a/test/static/unit_test.cpp b/test/static/unit_test.cpp index 25ef2ce2..a89d21ea 100644 --- a/test/static/unit_test.cpp +++ b/test/static/unit_test.cpp @@ -240,7 +240,6 @@ static_assert(si::yotta.symbol == "Ym"); static_assert(si::ronna.symbol == "Rm"); static_assert(si::quetta.symbol == "Qm"); - // scaled_unit constexpr auto m_1 = mag<1> * metre; static_assert(is_of_type);