forked from mpusz/mp-units
refactor: not needed remove_reference_t and remove_cvref_t removed
This commit is contained in:
@@ -41,7 +41,7 @@ void to_base_specialization_of_quantity(const volatile quantity<R, Rep>*);
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool is_derived_from_specialization_of_quantity =
|
||||
requires(std::remove_reference_t<T>* t) { to_base_specialization_of_quantity(t); };
|
||||
requires(T* t) { to_base_specialization_of_quantity(t); };
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
@@ -915,12 +915,11 @@ template<typename From, typename To>
|
||||
return extract_results{false};
|
||||
else if constexpr (from_exp > to_exp)
|
||||
return extract_results{true, pow<to_exp.num, to_exp.den>(from_factor), pow<to_exp.num, to_exp.den>(to_factor),
|
||||
prepend_rest::first,
|
||||
power_or_T<std::remove_cvref_t<decltype(from_factor)>, from_exp - to_exp>{}};
|
||||
prepend_rest::first, power_or_T<decltype(from_factor), from_exp - to_exp>{}};
|
||||
else
|
||||
return extract_results{true, pow<from_exp.num, from_exp.den>(from_factor),
|
||||
pow<from_exp.num, from_exp.den>(to_factor), prepend_rest::second,
|
||||
power_or_T<std::remove_cvref_t<decltype(to_factor)>, to_exp - from_exp>{}};
|
||||
power_or_T<decltype(to_factor), to_exp - from_exp>{}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -934,7 +933,7 @@ template<process_entities Entities, auto Ext, TypeList NumFrom, TypeList DenFrom
|
||||
if constexpr (Ext.prepend == prepend_rest::no)
|
||||
return min(res, are_ingredients_convertible(num_from, den_from, num_to, den_to));
|
||||
else {
|
||||
using elem = std::remove_cvref_t<decltype(Ext.elem)>;
|
||||
using elem = decltype(Ext.elem);
|
||||
if constexpr (Entities == process_entities::numerators) {
|
||||
if constexpr (Ext.prepend == prepend_rest::first)
|
||||
return min(res, are_ingredients_convertible(type_list_push_front<NumFrom, elem>{}, den_from, num_to, den_to));
|
||||
@@ -959,7 +958,7 @@ template<process_entities Entities, auto Ext, TypeList NumFrom, TypeList DenFrom
|
||||
if constexpr (Ext.prepend == prepend_rest::no)
|
||||
return are_ingredients_convertible(num_from, den_from, num_to, den_to);
|
||||
else {
|
||||
using elem = std::remove_cvref_t<decltype(Ext.elem)>;
|
||||
using elem = decltype(Ext.elem);
|
||||
if constexpr (Entities == process_entities::from) {
|
||||
if constexpr (Ext.prepend == prepend_rest::first)
|
||||
return are_ingredients_convertible(type_list_push_front<NumFrom, elem>{}, den_from, num_to, den_to);
|
||||
@@ -1342,8 +1341,7 @@ template<QuantitySpec From, QuantitySpec To>
|
||||
using enum specs_convertible_result;
|
||||
return res == no ? no : yes;
|
||||
};
|
||||
if constexpr ((NamedQuantitySpec<std::remove_cvref_t<decltype(from_kind)>> &&
|
||||
NamedQuantitySpec<std::remove_cvref_t<decltype(to_kind)>>) ||
|
||||
if constexpr ((NamedQuantitySpec<decltype(from_kind)> && NamedQuantitySpec<decltype(to_kind)>) ||
|
||||
get_complexity(from_kind) == get_complexity(to_kind))
|
||||
return convertible_impl(from_kind, to_kind);
|
||||
else if constexpr (get_complexity(from_kind) > get_complexity(to_kind))
|
||||
|
||||
@@ -140,9 +140,8 @@ namespace detail {
|
||||
|
||||
template<auto To, auto From>
|
||||
concept NestedQuantityKindSpecOf =
|
||||
QuantitySpec<decltype(From)> && QuantitySpec<decltype(To)> &&
|
||||
get_kind(From) != get_kind(To) &&
|
||||
std::derived_from<std::remove_cvref_t<decltype(To)>, std::remove_cvref_t<decltype(get_kind(From)._quantity_spec_)>>;
|
||||
QuantitySpec<decltype(From)> && QuantitySpec<decltype(To)> && get_kind(From) != get_kind(To) &&
|
||||
std::derived_from<decltype(To), std::remove_const_t<decltype(get_kind(From)._quantity_spec_)>>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -432,9 +432,9 @@ MP_UNITS_EXPORT_BEGIN
|
||||
* Multiplication by `1` returns the same unit, otherwise `scaled_unit` is being returned.
|
||||
*/
|
||||
template<Magnitude M, Unit U>
|
||||
[[nodiscard]] MP_UNITS_CONSTEVAL Unit auto operator*(M, const U u)
|
||||
[[nodiscard]] MP_UNITS_CONSTEVAL Unit auto operator*(M, U u)
|
||||
{
|
||||
if constexpr (std::is_same_v<M, std::remove_cvref_t<decltype(mp_units::mag<1>)>>)
|
||||
if constexpr (std::is_same_v<M, std::remove_const_t<decltype(mp_units::mag<1>)>>)
|
||||
return u;
|
||||
else
|
||||
return scaled_unit<M{}, U>{};
|
||||
@@ -446,7 +446,7 @@ template<Magnitude M, Unit U>
|
||||
* Returns the result of multiplication with an inverse unit.
|
||||
*/
|
||||
template<Magnitude M, Unit U>
|
||||
[[nodiscard]] MP_UNITS_CONSTEVAL Unit auto operator/(M mag, const U u)
|
||||
[[nodiscard]] MP_UNITS_CONSTEVAL Unit auto operator/(M mag, U u)
|
||||
{
|
||||
return mag * inverse(u);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user