From 07ad14efdbea1b75817a7eb25940cbf448bc9423 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 13 Jan 2013 09:41:14 -0800 Subject: [PATCH] Simplify traits. --- format.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/format.h b/format.h index 0948bd50..7c13470d 100644 --- a/format.h +++ b/format.h @@ -120,7 +120,10 @@ void Array::append(const T *begin, const T *end) { // IntTraits is not specialized for integer types smaller than int, // since these are promoted to int. template -struct IntTraits {}; +struct IntTraits { + typedef T UnsignedType; + static bool IsNegative(T) { return false; } +}; template struct SignedIntTraits { @@ -128,24 +131,12 @@ struct SignedIntTraits { static bool IsNegative(T value) { return value < 0; } }; -template -struct UnsignedIntTraits { - typedef T UnsignedType; - static bool IsNegative(T) { return false; } -}; - template <> struct IntTraits : SignedIntTraits {}; -template <> -struct IntTraits : UnsignedIntTraits {}; - template <> struct IntTraits : SignedIntTraits {}; -template <> -struct IntTraits : UnsignedIntTraits {}; - class ArgInserter; class FormatterProxy; }