forked from mpusz/mp-units
dimension refactoring
This commit is contained in:
@@ -213,9 +213,7 @@ namespace units {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<Exponent... Es>
|
template<Exponent... Es>
|
||||||
struct make_dimension {
|
using make_dimension = dim_consolidate<type_list_sort<typename extract<Es...>::type, exp_less>>::type;
|
||||||
using type = detail::dim_consolidate<type_list_sort<typename detail::extract<Es...>::type, exp_less>>::type;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
@@ -224,22 +222,13 @@ namespace units {
|
|||||||
struct derived_dimension : downcast_child<Child, typename detail::make_dimension<Es...>> {};
|
struct derived_dimension : downcast_child<Child, typename detail::make_dimension<Es...>> {};
|
||||||
|
|
||||||
// merge_dimension
|
// merge_dimension
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
template<Dimension D1, Dimension D2>
|
|
||||||
struct merge_dimension_impl {
|
|
||||||
using type = detail::dim_consolidate<type_list_merge_sorted<D1, D2, exp_less>>::type;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
template<Dimension D1, Dimension D2>
|
template<Dimension D1, Dimension D2>
|
||||||
using merge_dimension = detail::merge_dimension_impl<D1, D2>::type;
|
using merge_dimension = detail::dim_consolidate<type_list_merge_sorted<D1, D2, exp_less>>::type;
|
||||||
|
|
||||||
// dimension_multiply
|
// dimension_multiply
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<Dimension D1, Dimension D2>
|
template<typename D1, typename D2>
|
||||||
struct dimension_multiply_impl;
|
struct dimension_multiply_impl;
|
||||||
|
|
||||||
template<typename... E1, typename... E2>
|
template<typename... E1, typename... E2>
|
||||||
@@ -253,7 +242,7 @@ namespace units {
|
|||||||
// dimension_divide
|
// dimension_divide
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<Dimension D1, Dimension D2>
|
template<typename D1, typename D2>
|
||||||
struct dimension_divide_impl;
|
struct dimension_divide_impl;
|
||||||
|
|
||||||
template<typename... E1, typename... E2>
|
template<typename... E1, typename... E2>
|
||||||
@@ -269,7 +258,7 @@ namespace units {
|
|||||||
// dimension_sqrt
|
// dimension_sqrt
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<Dimension D>
|
template<typename D>
|
||||||
struct dimension_sqrt_impl;
|
struct dimension_sqrt_impl;
|
||||||
|
|
||||||
template<typename... Es>
|
template<typename... Es>
|
||||||
@@ -283,7 +272,7 @@ namespace units {
|
|||||||
// dimension_pow
|
// dimension_pow
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<Dimension D, std::size_t N>
|
template<typename D, std::size_t N>
|
||||||
struct dimension_pow_impl;
|
struct dimension_pow_impl;
|
||||||
|
|
||||||
template<typename... Es, std::size_t N>
|
template<typename... Es, std::size_t N>
|
||||||
|
@@ -58,7 +58,7 @@ namespace {
|
|||||||
// make_dimension
|
// make_dimension
|
||||||
|
|
||||||
template<typename... Ts>
|
template<typename... Ts>
|
||||||
using make_dimension = detail::make_dimension<Ts...>::type;
|
using make_dimension = detail::make_dimension<Ts...>;
|
||||||
|
|
||||||
static_assert(std::is_same_v<make_dimension<exp<d0, 1>>, dimension<exp<d0, 1>>>);
|
static_assert(std::is_same_v<make_dimension<exp<d0, 1>>, dimension<exp<d0, 1>>>);
|
||||||
static_assert(std::is_same_v<make_dimension<exp<d0, 1>, exp<d1, 1>>, dimension<exp<d0, 1>, exp<d1, 1>>>);
|
static_assert(std::is_same_v<make_dimension<exp<d0, 1>, exp<d1, 1>>, dimension<exp<d0, 1>, exp<d1, 1>>>);
|
||||||
|
Reference in New Issue
Block a user