diff --git a/src/core/include/mp-units/framework/quantity_spec.h b/src/core/include/mp-units/framework/quantity_spec.h index 03098bbc..2613d447 100644 --- a/src/core/include/mp-units/framework/quantity_spec.h +++ b/src/core/include/mp-units/framework/quantity_spec.h @@ -260,11 +260,11 @@ struct quantity_spec : detail::quantity_spec_interface * @tparam Args optionally a value of a `quantity_character` in case the base quantity should not be scalar */ #ifdef MP_UNITS_API_NO_CRTP -template auto... Args> +template auto... Args> requires(... && !QuantitySpec) struct quantity_spec : detail::quantity_spec_interface { #else -template auto... Args> +template auto... Args> requires(... && !QuantitySpec) struct quantity_spec : detail::quantity_spec_interface { #endif @@ -359,14 +359,14 @@ struct quantity_spec : decltype(QS) { * or `is_kind` in case the quantity starts a new hierarchy tree of a kind */ #ifdef MP_UNITS_API_NO_CRTP -template auto... Args> requires(!requires { QS._equation_; } || (requires { QS._equation_; } && (explicitly_convertible(Eq, QS._equation_)))) && (... && !QuantitySpec) struct quantity_spec : quantity_spec { #else -template auto... Args> requires(!requires { QS._equation_; } || (requires { QS._equation_; @@ -421,7 +421,7 @@ struct quantity_spec : quantity_spec { * @note User should not instantiate this type! It is not exported from the C++ module. The library will * instantiate this type automatically based on the dimensional arithmetic equation provided by the user. */ -template +template struct derived_quantity_spec : #ifdef MP_UNITS_API_NO_CRTP detail::quantity_spec_interface, @@ -454,7 +454,7 @@ MP_UNITS_EXPORT QUANTITY_SPEC(dimensionless, derived_quantity_spec<>{}); namespace detail { template -concept QuantitySpecWithNoSpecifiers = detail::NamedQuantitySpec || detail::IntermediateDerivedQuantitySpec; +concept QuantitySpecWithNoSpecifiers = detail::NamedQuantitySpec || detail::DerivedQuantitySpec; template [[nodiscard]] consteval QuantitySpec auto get_kind_tree_root(Q q); @@ -556,7 +556,7 @@ template return dimensionless; else if constexpr (detail::ratio{Num, Den} == 1) return q; - else if constexpr (detail::IntermediateDerivedQuantitySpec) + else if constexpr (detail::DerivedQuantitySpec) return detail::clone_kind_of( detail::expr_pow( detail::remove_kind(q))); @@ -616,7 +616,7 @@ template template [[nodiscard]] consteval int get_complexity(Q) { - if constexpr (detail::IntermediateDerivedQuantitySpec) + if constexpr (detail::DerivedQuantitySpec) return get_complexity(typename Q::_num_{}) + get_complexity(typename Q::_den_{}); else if constexpr (requires { Q::_equation_; }) return 1 + get_complexity(Q::_equation_); @@ -709,7 +709,7 @@ explode_result(Q) -> explode_result; #endif -template +template [[nodiscard]] consteval auto explode(Q q); template @@ -771,7 +771,7 @@ template return explode_result{dimensionless}; } -template +template [[nodiscard]] consteval auto explode(Q q) { constexpr auto c = get_complexity(Q{}); @@ -1304,7 +1304,7 @@ template return specs_convertible_result::yes; } -template +template [[nodiscard]] consteval specs_convertible_result are_ingredients_convertible(From, To) { return are_ingredients_convertible(type_list_sort{}, @@ -1313,7 +1313,7 @@ template{}); } -template +template [[nodiscard]] consteval specs_convertible_result are_ingredients_convertible(From, To) { return are_ingredients_convertible(type_list_sort{}, @@ -1321,7 +1321,7 @@ template type_list{}, type_list<>{}); } -template +template [[nodiscard]] consteval specs_convertible_result are_ingredients_convertible(From, To) { return are_ingredients_convertible(type_list{}, type_list<>{}, @@ -1385,9 +1385,9 @@ template return yes; else if constexpr (NamedQuantitySpec && NamedQuantitySpec) { return convertible_named(from, to); - } else if constexpr (IntermediateDerivedQuantitySpec && IntermediateDerivedQuantitySpec) { + } else if constexpr (DerivedQuantitySpec && DerivedQuantitySpec) { return are_ingredients_convertible(from, to); - } else if constexpr (IntermediateDerivedQuantitySpec) { + } else if constexpr (DerivedQuantitySpec) { auto res = explode(from); if constexpr (NamedQuantitySpec) return convertible_impl(res.quantity, to); @@ -1396,7 +1396,7 @@ template return min(eq.result, convertible_impl(res.quantity, eq.equation)); } else return are_ingredients_convertible(from, to); - } else if constexpr (IntermediateDerivedQuantitySpec) { + } else if constexpr (DerivedQuantitySpec) { auto res = explode(to); if constexpr (NamedQuantitySpec) return min(res.result, convertible_impl(from, res.quantity)); @@ -1473,7 +1473,7 @@ template return q; } else if constexpr (requires { Q::_parent_; }) { return get_kind_tree_root(Q::_parent_); - } else if constexpr (detail::IntermediateDerivedQuantitySpec) { + } else if constexpr (detail::DerivedQuantitySpec) { return detail::expr_map(q); } else { @@ -1511,11 +1511,11 @@ template else if constexpr (detail::NestedQuantityKindSpecOf) return detail::remove_kind(q2); else if constexpr ((detail::QuantityKindSpec && !detail::QuantityKindSpec) || - (detail::IntermediateDerivedQuantitySpec && detail::NamedQuantitySpec && + (detail::DerivedQuantitySpec && detail::NamedQuantitySpec && implicitly_convertible(Q1{}, Q2{}))) return q2; else if constexpr ((!detail::QuantityKindSpec && detail::QuantityKindSpec) || - (detail::NamedQuantitySpec && detail::IntermediateDerivedQuantitySpec && + (detail::NamedQuantitySpec && detail::DerivedQuantitySpec && implicitly_convertible(Q2{}, Q1{}))) return q1; else if constexpr (detail::have_common_base(Q1{}, Q2{})) 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 ab5b047d..3d511b5a 100644 --- a/src/core/include/mp-units/framework/quantity_spec_concepts.h +++ b/src/core/include/mp-units/framework/quantity_spec_concepts.h @@ -101,13 +101,12 @@ inline constexpr bool is_per_of_quantity_specs> = (... && (NamedQuantitySpec || is_dimensionless::value || is_power_of_quantity_spec)); template -concept IntermediateDerivedQuantitySpecExpr = - detail::NamedQuantitySpec || detail::is_dimensionless::value || detail::is_power_of_quantity_spec || - detail::is_per_of_quantity_specs; +concept DerivedQuantitySpecExpr = detail::NamedQuantitySpec || detail::is_dimensionless::value || + detail::is_power_of_quantity_spec || detail::is_per_of_quantity_specs; } // namespace detail -template +template struct derived_quantity_spec; namespace detail { @@ -121,7 +120,7 @@ namespace detail { * explicitly not supported here. */ template -concept IntermediateDerivedQuantitySpec = +concept DerivedQuantitySpec = is_specialization_of || (QuantityKindSpec && is_specialization_of, derived_quantity_spec>); @@ -130,8 +129,7 @@ concept IntermediateDerivedQuantitySpec = MP_UNITS_EXPORT template -concept QuantitySpec = - detail::NamedQuantitySpec || detail::IntermediateDerivedQuantitySpec || detail::QuantityKindSpec; +concept QuantitySpec = detail::NamedQuantitySpec || detail::DerivedQuantitySpec || detail::QuantityKindSpec; MP_UNITS_EXPORT template [[nodiscard]] consteval detail::QuantityKindSpec auto get_kind(Q q);