forked from mpusz/mp-units
dimension_traits and unit_traits merged as upcasting_traits
This commit is contained in:
@@ -84,14 +84,6 @@ namespace units {
|
||||
template<Exponent E>
|
||||
using exp_invert_t = typename exp_invert<E>::type;
|
||||
|
||||
// dimension_traits
|
||||
|
||||
template<typename T>
|
||||
struct dimension_traits : std::type_identity<T> {};
|
||||
|
||||
template<typename T>
|
||||
using dimension_traits_t = typename dimension_traits<T>::type;
|
||||
|
||||
// dimension
|
||||
|
||||
template<Exponent... Es>
|
||||
@@ -121,7 +113,7 @@ namespace units {
|
||||
struct dim_invert;
|
||||
|
||||
template<Exponent... Es>
|
||||
struct dim_invert<dimension<Es...>> : std::type_identity<dimension_traits_t<dimension<exp_invert_t<Es>...>>> {};
|
||||
struct dim_invert<dimension<Es...>> : std::type_identity<upcasting_traits_t<dimension<exp_invert_t<Es>...>>> {};
|
||||
|
||||
template<Dimension D>
|
||||
using dim_invert_t = typename dim_invert<typename D::base_type>::type;
|
||||
@@ -176,7 +168,7 @@ namespace units {
|
||||
struct dimension_multiply;
|
||||
|
||||
template<Exponent... E1, Exponent... E2>
|
||||
struct dimension_multiply<dimension<E1...>, dimension<E2...>> : std::type_identity<dimension_traits_t<make_dimension_t<E1..., E2...>>> {};
|
||||
struct dimension_multiply<dimension<E1...>, dimension<E2...>> : std::type_identity<upcasting_traits_t<make_dimension_t<E1..., E2...>>> {};
|
||||
|
||||
template<Dimension D1, Dimension D2>
|
||||
using dimension_multiply_t = typename dimension_multiply<typename D1::base_type, typename D2::base_type>::type;
|
||||
|
||||
Reference in New Issue
Block a user