From 51d05521e96870daef27cef95840fbb5ea287370 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 8e93a565..abf2ed9a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -731,13 +731,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; }