From ccf8561cb3e85676179c286e3e40edaebe0a45ae Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 30 Jul 2020 09:42:24 -0700 Subject: [PATCH] Workaround broken numeric_limites, part 2 (#1787) --- include/fmt/format.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 7213a0da..ca7cefd9 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -724,13 +724,18 @@ class FMT_API format_error : public std::runtime_error { namespace detail { +template +constexpr bool is_signed() { + return std::numeric_limits::is_signed || std::is_same(); +} + // Returns true if value is negative, false otherwise. // Same as `value < 0` but doesn't produce warnings if T is an unsigned type. -template ::is_signed)> +template ())> FMT_CONSTEXPR bool is_negative(T value) { return value < 0; } -template ::is_signed)> +template ())> FMT_CONSTEXPR bool is_negative(T) { return false; }