diff --git a/doc/DESIGN.md b/doc/DESIGN.md index 82333bc0..cb6ac186 100644 --- a/doc/DESIGN.md +++ b/doc/DESIGN.md @@ -179,17 +179,6 @@ contained base dimensions. Beside providing ordering to base dimensions it also - aggregate two arguments of the same base dimension but different exponents - eliminate two arguments of the same base dimension and with opposite equal exponents -Additionally, it would be good if the final type produced by `make_dimension_t` would be easy to -understand for the user. For example we may decide to order base dimensions with decreasing order of -their exponents. That is why second sorting of a type list may be required. For example: - -```cpp -template -struct make_dimension { - using type = mp::type_list_sort_t, exp_dim_id_less>>, exp_greater_equal>; -}; -``` - #### `merge_dimension` @@ -218,7 +207,7 @@ Example implementation of `merge_dimension` may look like: ```cpp template struct merge_dimension { - using type = mp::type_list_sort_t>, exp_greater_equal>; + using type = detail::dim_consolidate_t>; }; ``` diff --git a/src/include/units/dimension.h b/src/include/units/dimension.h index 55c1ea32..06ce4649 100644 --- a/src/include/units/dimension.h +++ b/src/include/units/dimension.h @@ -65,12 +65,6 @@ namespace units { struct exp_dim_id_less : dim_id_less { }; - // exp_dim_id_less - - template - struct exp_greater_equal : std::bool_constant<(E1::value >= E2::value)> { - }; - // exp_invert template @@ -154,7 +148,7 @@ namespace units { template struct make_dimension { - using type = type_list_sort, exp_dim_id_less>>, exp_greater_equal>; + using type = detail::dim_consolidate_t, exp_dim_id_less>>; }; template @@ -162,7 +156,7 @@ namespace units { template struct merge_dimension { - using type = type_list_sort>, exp_greater_equal>; + using type = detail::dim_consolidate_t>; }; template diff --git a/test/unit_test/test_dimension.cpp b/test/unit_test/test_dimension.cpp index 1c30c757..dd09d602 100644 --- a/test/unit_test/test_dimension.cpp +++ b/test/unit_test/test_dimension.cpp @@ -59,7 +59,7 @@ namespace { static_assert(std::is_same_v, e<1, 1>, e<2, 1>>, dimension>>, dimension, e<1, 1>, e<2, 1>, e<3, 1>>>); static_assert(std::is_same_v, e<1, 1>, e<2, 1>>, dimension>>, - dimension, e<0, 1>, e<2, 1>>>); + dimension, e<1, 2>, e<2, 1>>>); static_assert(std::is_same_v, e<1, 1>, e<2, 1>>, dimension>>, dimension, e<2, 1>>>);