forked from mpusz/mp-units
Library updated to the latest cmake common tools
This commit is contained in:
@@ -33,7 +33,7 @@ template<Exponent E>
|
||||
struct exp_ratio {
|
||||
using base_ratio = E::dimension::base_unit::ratio;
|
||||
using positive_ratio = conditional<E::num * E::den < 0, ratio<base_ratio::den, base_ratio::num, -base_ratio::exp>, base_ratio>;
|
||||
static constexpr std::int64_t N = E::num * E::den < 0 ? -E::num : E::num;
|
||||
static constexpr std::intmax_t N = E::num * E::den < 0 ? -E::num : E::num;
|
||||
using pow = ratio_pow<positive_ratio, N>;
|
||||
using type = conditional<E::den == 2, ratio_sqrt<pow>, pow>;
|
||||
};
|
||||
|
||||
@@ -54,7 +54,7 @@ struct dim_consolidate<exp_list<E1, ERest...>> {
|
||||
using type = type_list_push_front<typename dim_consolidate<exp_list<ERest...>>::type, E1>;
|
||||
};
|
||||
|
||||
template<BaseDimension Dim, int Num1, int Den1, int Num2, int Den2, typename... ERest>
|
||||
template<BaseDimension Dim, std::intmax_t Num1, std::intmax_t Den1, std::intmax_t Num2, std::intmax_t Den2, typename... ERest>
|
||||
struct dim_consolidate<exp_list<exp<Dim, Num1, Den1>, exp<Dim, Num2, Den2>, ERest...>> {
|
||||
// TODO: provide custom implementation for ratio_add
|
||||
using r1 = std::ratio<Num1, Den1>;
|
||||
|
||||
@@ -41,17 +41,17 @@ struct dim_unpack<> {
|
||||
using type = exp_list<>;
|
||||
};
|
||||
|
||||
template<BaseDimension Dim, int Num, int Den, Exponent... ERest>
|
||||
template<BaseDimension Dim, std::intmax_t Num, std::intmax_t Den, Exponent... ERest>
|
||||
struct dim_unpack<exp<Dim, Num, Den>, ERest...> {
|
||||
using type = type_list_push_front<typename dim_unpack<ERest...>::type, exp<Dim, Num, Den>>;
|
||||
};
|
||||
|
||||
template<DerivedDimension Dim, int Num, int Den, Exponent... ERest>
|
||||
template<DerivedDimension Dim, std::intmax_t Num, std::intmax_t Den, Exponent... ERest>
|
||||
struct dim_unpack<exp<Dim, Num, Den>, ERest...> {
|
||||
using type = dim_unpack<exp<downcast_base_t<Dim>, Num, Den>, ERest...>::type;
|
||||
};
|
||||
|
||||
template<Exponent... Es, int Num, int Den, Exponent... ERest>
|
||||
template<Exponent... Es, std::intmax_t Num, std::intmax_t Den, Exponent... ERest>
|
||||
struct dim_unpack<exp<derived_dimension_base<Es...>, Num, Den>, ERest...> {
|
||||
using type = type_list_push_front<typename dim_unpack<ERest...>::type, exp_multiply<Es, Num, Den>...>;
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ struct equivalent_dim_impl<D1, D2> : std::disjunction<std::is_same<D1, D2>, equi
|
||||
template<Exponent E1, Exponent E2>
|
||||
struct equivalent_exp : std::false_type {};
|
||||
|
||||
template<BaseDimension Dim1, int Num, int Den, BaseDimension Dim2>
|
||||
template<BaseDimension Dim1, std::intmax_t Num, std::intmax_t Den, BaseDimension Dim2>
|
||||
struct equivalent_exp<exp<Dim1, Num, Den>, exp<Dim2, Num, Den>> : equivalent_dim_impl<Dim1, Dim2> {};
|
||||
|
||||
template<DerivedDimension D1, DerivedDimension D2>
|
||||
@@ -230,10 +230,10 @@ using dimension_sqrt = detail::dimension_sqrt_impl<D>::type;
|
||||
// dimension_pow
|
||||
namespace detail {
|
||||
|
||||
template<Dimension D, std::size_t N>
|
||||
template<Dimension D, std::intmax_t N>
|
||||
struct dimension_pow_impl;
|
||||
|
||||
template<BaseDimension D, std::size_t N>
|
||||
template<BaseDimension D, std::intmax_t N>
|
||||
struct dimension_pow_impl<D, N> {
|
||||
using type = downcast_dimension<derived_dimension_base<exp<D, N>>>;
|
||||
};
|
||||
@@ -243,24 +243,24 @@ struct dimension_pow_impl<D, 1> {
|
||||
using type = D;
|
||||
};
|
||||
|
||||
template<BaseDimension D, std::size_t N>
|
||||
template<BaseDimension D, std::intmax_t N>
|
||||
struct dimension_pow_impl<derived_dimension_base<exp<D, 1, N>>, N> {
|
||||
using type = D;
|
||||
};
|
||||
|
||||
template<DerivedDimension D, std::size_t N>
|
||||
template<DerivedDimension D, std::intmax_t N>
|
||||
struct dimension_pow_impl<D, N> {
|
||||
using type = dimension_pow_impl<downcast_base_t<D>, N>::type;
|
||||
};
|
||||
|
||||
template<typename... Es, std::size_t N>
|
||||
template<typename... Es, std::intmax_t N>
|
||||
struct dimension_pow_impl<derived_dimension_base<Es...>, N> {
|
||||
using type = downcast_dimension<derived_dimension_base<exp_multiply<Es, N, 1>...>>;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<Dimension D, std::size_t N>
|
||||
template<Dimension D, std::intmax_t N>
|
||||
using dimension_pow = detail::dimension_pow_impl<D, N>::type;
|
||||
|
||||
} // namespace units
|
||||
|
||||
Reference in New Issue
Block a user