forked from mpusz/mp-units
[msvc][fix] remove MP_UNITS_IS_CONST_EXPR_WORKAROUND
This commit is contained in:
@@ -76,9 +76,9 @@ template<AssociatedUnit U>
|
|||||||
template<AssociatedUnit U>
|
template<AssociatedUnit U>
|
||||||
[[nodiscard]] consteval auto get_associated_quantity(U u)
|
[[nodiscard]] consteval auto get_associated_quantity(U u)
|
||||||
{
|
{
|
||||||
constexpr bool all_kinds = all_are_kinds(MP_UNITS_IS_CONST_EXPR_WORKAROUND(u));
|
constexpr bool all_kinds = all_are_kinds(U{});
|
||||||
if constexpr (all_kinds)
|
if constexpr (all_kinds)
|
||||||
return kind_of<get_associated_quantity_impl(MP_UNITS_IS_CONST_EXPR_WORKAROUND(u))>;
|
return kind_of<get_associated_quantity_impl(U{})>;
|
||||||
else
|
else
|
||||||
return get_associated_quantity_impl(u);
|
return get_associated_quantity_impl(u);
|
||||||
}
|
}
|
||||||
|
@@ -118,15 +118,12 @@ inline constexpr from_range_t from_range{};
|
|||||||
#define MP_UNITS_CONSTRAINED_NTTP_WORKAROUND(X)
|
#define MP_UNITS_CONSTRAINED_NTTP_WORKAROUND(X)
|
||||||
#define MP_UNITS_EXPRESSION_WORKAROUND(x) (x)
|
#define MP_UNITS_EXPRESSION_WORKAROUND(x) (x)
|
||||||
#define MP_UNITS_IS_VALUE_WORKAROUND(x) (x)
|
#define MP_UNITS_IS_VALUE_WORKAROUND(x) (x)
|
||||||
#define MP_UNITS_IS_CONST_EXPR_WORKAROUND(x) \
|
|
||||||
decltype(x) {}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define MP_UNITS_CONSTRAINED_NTTP_WORKAROUND(X) X
|
#define MP_UNITS_CONSTRAINED_NTTP_WORKAROUND(X) X
|
||||||
#define MP_UNITS_EXPRESSION_WORKAROUND(x) x
|
#define MP_UNITS_EXPRESSION_WORKAROUND(x) x
|
||||||
#define MP_UNITS_IS_VALUE_WORKAROUND(x) x
|
#define MP_UNITS_IS_VALUE_WORKAROUND(x) x
|
||||||
#define MP_UNITS_IS_CONST_EXPR_WORKAROUND(x) x
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1345,14 +1345,10 @@ template<QuantitySpec From, QuantitySpec To>
|
|||||||
return convertible_impl(from_kind, to_kind);
|
return convertible_impl(from_kind, to_kind);
|
||||||
else if constexpr (get_complexity(From{}) > get_complexity(To{}))
|
else if constexpr (get_complexity(From{}) > get_complexity(To{}))
|
||||||
return exploded_kind_result(convertible_impl(
|
return exploded_kind_result(convertible_impl(
|
||||||
get_kind_tree_root(
|
get_kind_tree_root(explode<get_complexity(To{})>(from_kind).quantity),to_kind));
|
||||||
explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to_kind))>(from_kind).quantity),
|
|
||||||
to_kind));
|
|
||||||
else
|
else
|
||||||
return exploded_kind_result(convertible_impl(
|
return exploded_kind_result(
|
||||||
from_kind,
|
convertible_impl(from_kind,get_kind_tree_root(explode<get_complexity(From{})>(to_kind).quantity)));
|
||||||
get_kind_tree_root(
|
|
||||||
explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from_kind))>(to_kind).quantity)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<NamedQuantitySpec From, NamedQuantitySpec To>
|
template<NamedQuantitySpec From, NamedQuantitySpec To>
|
||||||
@@ -1369,11 +1365,9 @@ template<NamedQuantitySpec From, NamedQuantitySpec To>
|
|||||||
return no;
|
return no;
|
||||||
else if constexpr (get_complexity(From{}) != get_complexity(To{})) {
|
else if constexpr (get_complexity(From{}) != get_complexity(To{})) {
|
||||||
if constexpr (get_complexity(From{}) > get_complexity(To{}))
|
if constexpr (get_complexity(From{}) > get_complexity(To{}))
|
||||||
return convertible_impl(
|
return convertible_impl(explode<get_complexity(To{})>(from).quantity,to);
|
||||||
explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to))>(from).quantity,
|
|
||||||
to);
|
|
||||||
else {
|
else {
|
||||||
auto res = explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from))>(to);
|
auto res = explode<get_complexity(From{})>(to);
|
||||||
return min(res.result, convertible_impl(from, res.quantity));
|
return min(res.result, convertible_impl(from, res.quantity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1398,7 +1392,7 @@ template<QuantitySpec From, QuantitySpec To>
|
|||||||
else if constexpr (DerivedQuantitySpec<From> && DerivedQuantitySpec<To>)
|
else if constexpr (DerivedQuantitySpec<From> && DerivedQuantitySpec<To>)
|
||||||
return are_ingredients_convertible(from, to);
|
return are_ingredients_convertible(from, to);
|
||||||
else if constexpr (DerivedQuantitySpec<From>) {
|
else if constexpr (DerivedQuantitySpec<From>) {
|
||||||
auto res = explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(to))>(from);
|
auto res = explode<get_complexity(To{})>(from);
|
||||||
if constexpr (NamedQuantitySpec<decltype(res.quantity)>)
|
if constexpr (NamedQuantitySpec<decltype(res.quantity)>)
|
||||||
return convertible_impl(res.quantity, to);
|
return convertible_impl(res.quantity, to);
|
||||||
else if constexpr (requires { to._equation_; }) {
|
else if constexpr (requires { to._equation_; }) {
|
||||||
@@ -1407,7 +1401,7 @@ template<QuantitySpec From, QuantitySpec To>
|
|||||||
} else
|
} else
|
||||||
return are_ingredients_convertible(from, to);
|
return are_ingredients_convertible(from, to);
|
||||||
} else if constexpr (DerivedQuantitySpec<To>) {
|
} else if constexpr (DerivedQuantitySpec<To>) {
|
||||||
auto res = explode<get_complexity(MP_UNITS_IS_CONST_EXPR_WORKAROUND(from))>(to);
|
auto res = explode<get_complexity(From{})>(to);
|
||||||
if constexpr (NamedQuantitySpec<decltype(res.quantity)>)
|
if constexpr (NamedQuantitySpec<decltype(res.quantity)>)
|
||||||
return min(res.result, convertible_impl(from, res.quantity));
|
return min(res.result, convertible_impl(from, res.quantity));
|
||||||
else if constexpr (requires { from._equation_; })
|
else if constexpr (requires { from._equation_; })
|
||||||
@@ -1498,9 +1492,9 @@ template<QuantitySpec Q>
|
|||||||
MP_UNITS_EXPORT_BEGIN
|
MP_UNITS_EXPORT_BEGIN
|
||||||
|
|
||||||
template<QuantitySpec Q>
|
template<QuantitySpec Q>
|
||||||
[[nodiscard]] consteval detail::QuantityKindSpec auto get_kind(Q q)
|
[[nodiscard]] consteval detail::QuantityKindSpec auto get_kind(Q)
|
||||||
{
|
{
|
||||||
return kind_of<detail::get_kind_tree_root(MP_UNITS_IS_CONST_EXPR_WORKAROUND(q))>;
|
return kind_of<detail::get_kind_tree_root(Q{})>;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] consteval QuantitySpec auto common_quantity_spec(QuantitySpec auto q) { return q; }
|
[[nodiscard]] consteval QuantitySpec auto common_quantity_spec(QuantitySpec auto q) { return q; }
|
||||||
|
@@ -292,9 +292,9 @@ template<Reference R1, Reference R2, Reference... Rest>
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
return detail::reference_t<
|
return detail::reference_t<
|
||||||
common_quantity_spec(get_quantity_spec(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r1)), get_quantity_spec(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r2)),
|
common_quantity_spec(get_quantity_spec(R1{}), get_quantity_spec(R2{}),
|
||||||
get_quantity_spec(rest)...),
|
get_quantity_spec(rest)...),
|
||||||
common_unit(get_unit(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r1)), get_unit(MP_UNITS_IS_CONST_EXPR_WORKAROUND(r2)), get_unit(rest)...)>{};
|
common_unit(get_unit(R1{}), get_unit(R2{}), get_unit(rest)...)>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
MP_UNITS_EXPORT_END
|
MP_UNITS_EXPORT_END
|
||||||
|
Reference in New Issue
Block a user