fix: std::abs freestanding compilation issue fixed

This commit is contained in:
Mateusz Pusz
2024-11-26 16:54:05 +01:00
parent 781aa84a82
commit 52b003e6ea

View File

@ -208,7 +208,11 @@ struct magnitude_t {
else if constexpr (requires { abs(vec); })
return abs(vec);
else if constexpr (std::is_arithmetic_v<T> && (!is_same_v<T, bool>))
#if MP_UNITS_HOSTED || __cpp_lib_freestanding_cstdlib >= 202306L
return std::abs(vec);
#else
return vec >= 0 ? vec : -vec;
#endif
}
}
};