From 885d1a1c6461d0aa0a6925def363ba117d71abad Mon Sep 17 00:00:00 2001 From: vitaut Date: Wed, 25 Mar 2015 08:50:48 -0700 Subject: [PATCH] Simplify NonZero --- format.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/format.h b/format.h index 1eb81ac8..b371151c 100644 --- a/format.h +++ b/format.h @@ -700,16 +700,11 @@ void format_windows_error(fmt::Writer &out, int error_code, fmt::StringRef message) FMT_NOEXCEPT; #endif -// Computes max(Arg, 1) at compile time. It is used to avoid errors about +// Computes max(N, 1) at compile time. It is used to avoid errors about // allocating an array of 0 size. -template +template struct NonZero { - enum { VALUE = Arg }; -}; - -template <> -struct NonZero<0> { - enum { VALUE = 1 }; + enum { VALUE = N > 0 ? N : 0 }; }; // A formatting argument. It is a POD type to allow storage in