mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 10:27:16 +02:00
fix: std::abs
freestanding compilation issue fixed
This commit is contained in:
@ -208,7 +208,11 @@ struct magnitude_t {
|
|||||||
else if constexpr (requires { abs(vec); })
|
else if constexpr (requires { abs(vec); })
|
||||||
return abs(vec);
|
return abs(vec);
|
||||||
else if constexpr (std::is_arithmetic_v<T> && (!is_same_v<T, bool>))
|
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);
|
return std::abs(vec);
|
||||||
|
#else
|
||||||
|
return vec >= 0 ? vec : -vec;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user