mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-07 14:14:27 +02:00
Remove useful names to appease MSVC 14
Looks like another compiler bug, where it considers a formal parameter to be "unused" if it isn't used in any `if constexpr` branch.
This commit is contained in:
@@ -577,16 +577,16 @@ constexpr auto common_magnitude(Magnitude auto m, magnitude<>) { return detail::
|
|||||||
|
|
||||||
// Recursive case for the common Magnitude of any two non-identity Magnitudes.
|
// Recursive case for the common Magnitude of any two non-identity Magnitudes.
|
||||||
template<auto H1, auto... T1, auto H2, auto... T2>
|
template<auto H1, auto... T1, auto H2, auto... T2>
|
||||||
constexpr auto common_magnitude(magnitude<H1, T1...> m1, magnitude<H2, T2...> m2)
|
constexpr auto common_magnitude(magnitude<H1, T1...>, magnitude<H2, T2...>)
|
||||||
{
|
{
|
||||||
using detail::remove_positive_power;
|
using detail::remove_positive_power;
|
||||||
|
|
||||||
if constexpr (H1.get_base() < H2.get_base()) {
|
if constexpr (H1.get_base() < H2.get_base()) {
|
||||||
// When H1 has the smaller base, prepend to result from recursion.
|
// When H1 has the smaller base, prepend to result from recursion.
|
||||||
return remove_positive_power(magnitude<H1>{}) * common_magnitude(magnitude<T1...>{}, m2);
|
return remove_positive_power(magnitude<H1>{}) * common_magnitude(magnitude<T1...>{}, magnitude<H2, T2...>{});
|
||||||
} else if constexpr (H2.get_base() < H1.get_base()) {
|
} else if constexpr (H2.get_base() < H1.get_base()) {
|
||||||
// When H2 has the smaller base, prepend to result from recursion.
|
// When H2 has the smaller base, prepend to result from recursion.
|
||||||
return remove_positive_power(magnitude<H2>{}) * common_magnitude(m1, magnitude<T2...>{});
|
return remove_positive_power(magnitude<H2>{}) * common_magnitude(magnitude<H1, T1...>{}, magnitude<T2...>{});
|
||||||
} else {
|
} else {
|
||||||
// When the bases are equal, pick whichever has the lower power.
|
// When the bases are equal, pick whichever has the lower power.
|
||||||
constexpr auto common_tail = common_magnitude(magnitude<T1...>{}, magnitude<T2...>{});
|
constexpr auto common_tail = common_magnitude(magnitude<T1...>{}, magnitude<T2...>{});
|
||||||
|
Reference in New Issue
Block a user