Commit ccf8561c authored by Victor Zverovich's avatar Victor Zverovich

Workaround broken numeric_limites, part 2 (#1787)

parent 0cc73ebf
......@@ -724,13 +724,18 @@ class FMT_API format_error : public std::runtime_error {
namespace detail {
template <typename T>
constexpr bool is_signed() {
return std::numeric_limits<T>::is_signed || std::is_same<T, int128_t>();
}
// Returns true if value is negative, false otherwise.
// Same as `value < 0` but doesn't produce warnings if T is an unsigned type.
template <typename T, FMT_ENABLE_IF(std::numeric_limits<T>::is_signed)>
template <typename T, FMT_ENABLE_IF(is_signed<T>())>
FMT_CONSTEXPR bool is_negative(T value) {
return value < 0;
}
template <typename T, FMT_ENABLE_IF(!std::numeric_limits<T>::is_signed)>
template <typename T, FMT_ENABLE_IF(!is_signed<T>())>
FMT_CONSTEXPR bool is_negative(T) {
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment