From 48fcbb8030108ddee4aadeaa1301a201975ea72e Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Sat, 26 Oct 2024 19:14:11 +0200 Subject: [PATCH] feat: `DerivedDimensionExpr` removed --- src/core/include/mp-units/framework/dimension.h | 13 ++++++++----- .../mp-units/framework/dimension_concepts.h | 17 ----------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/core/include/mp-units/framework/dimension.h b/src/core/include/mp-units/framework/dimension.h index 72b15dd65..24a1e7b84 100644 --- a/src/core/include/mp-units/framework/dimension.h +++ b/src/core/include/mp-units/framework/dimension.h @@ -52,20 +52,23 @@ import std; namespace mp_units { -template +template struct derived_dimension; MP_UNITS_EXPORT struct dimension_one; namespace detail { +template +struct is_dimension_one : std::false_type {}; + template struct base_dimension_less : std::bool_constant() < type_name()> {}; template using type_list_of_base_dimension_less = expr_less; -template +template struct derived_dimension_impl : expr_fractions {}; struct dimension_interface { @@ -165,7 +168,7 @@ struct base_dimension : detail::dimension_interface { * @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_dimension final : detail::dimension_interface, detail::derived_dimension_impl {}; /** @@ -250,14 +253,14 @@ constexpr auto dimension_symbol_impl(Out out, const power&, cons return copy_symbol_exponent(fmt.encoding, negative_power, out); } -template Out, DerivedDimensionExpr... Ms> +template Out, typename... Ms> constexpr Out dimension_symbol_impl(Out out, const type_list&, const dimension_symbol_formatting& fmt, bool negative_power) { return (..., (out = dimension_symbol_impl(out, Ms{}, fmt, negative_power))); } -template Out, DerivedDimensionExpr... Nums, DerivedDimensionExpr... Dens> +template Out, typename... Nums, typename... Dens> constexpr Out dimension_symbol_impl(Out out, const type_list& nums, const type_list& dens, const dimension_symbol_formatting& fmt) { diff --git a/src/core/include/mp-units/framework/dimension_concepts.h b/src/core/include/mp-units/framework/dimension_concepts.h index 18bec37aa..6e3c653b6 100644 --- a/src/core/include/mp-units/framework/dimension_concepts.h +++ b/src/core/include/mp-units/framework/dimension_concepts.h @@ -57,23 +57,6 @@ namespace detail { template concept BaseDimension = Dimension && is_derived_from_specialization_of_v; -template -struct is_dimension_one : std::false_type {}; - -template -concept IsPowerOfDim = - is_specialization_of_power && (BaseDimension || is_dimension_one::value); - -template -constexpr bool is_per_of_dims = false; - -template -constexpr bool is_per_of_dims> = - (... && (BaseDimension || is_dimension_one::value || IsPowerOfDim)); - -template -concept DerivedDimensionExpr = BaseDimension || is_dimension_one::value || IsPowerOfDim || is_per_of_dims; - } // namespace detail /**