mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 04:44:27 +02:00
Clean up
This commit is contained in:
@@ -368,9 +368,6 @@ struct magnitude {
|
|||||||
|
|
||||||
// Whether this magnitude represents a rational number.
|
// Whether this magnitude represents a rational number.
|
||||||
friend constexpr bool is_rational(const magnitude&) { return (detail::is_rational(BPs) && ...); }
|
friend constexpr bool is_rational(const magnitude&) { return (detail::is_rational(BPs) && ...); }
|
||||||
|
|
||||||
// Implicit conversion to ratio.
|
|
||||||
constexpr explicit(false) operator ratio() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation for Magnitude concept (below).
|
// Implementation for Magnitude concept (below).
|
||||||
@@ -395,7 +392,7 @@ template<typename T, BasePower auto... BPs>
|
|||||||
constexpr T get_value(const magnitude<BPs...>&)
|
constexpr T get_value(const magnitude<BPs...>&)
|
||||||
{
|
{
|
||||||
// Force the expression to be evaluated in a constexpr context, to catch, e.g., overflow.
|
// Force the expression to be evaluated in a constexpr context, to catch, e.g., overflow.
|
||||||
constexpr auto result = detail::checked_static_cast<T>((detail::compute_base_power<T>(BPs) * ... * 1));
|
constexpr auto result = detail::checked_static_cast<T>((detail::compute_base_power<T>(BPs) * ... * T{1}));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -383,12 +383,10 @@ TEST_CASE("Constructing ratio from rational magnitude")
|
|||||||
SECTION("Irrational magnitude does not convert to ratio")
|
SECTION("Irrational magnitude does not convert to ratio")
|
||||||
{
|
{
|
||||||
// The following code should not compile.
|
// The following code should not compile.
|
||||||
// constexpr ratio radical = pow<ratio{1, 2}>(as_magnitude<2>());
|
// as_ratio(pow<ratio{1, 2}>(as_magnitude<2>()));
|
||||||
// (void)radical;
|
|
||||||
|
|
||||||
// The following code should not compile.
|
// The following code should not compile.
|
||||||
// constexpr ratio degrees_per_radian = as_magnitude<180>() / pi_to_the<1>();
|
// as_ratio(as_magnitude<180>() / pi_to_the<1>());
|
||||||
// (void)degrees_per_radian;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user