Commit 07ad14ef authored by Victor Zverovich's avatar Victor Zverovich

Simplify traits.

parent 2ca696d4
......@@ -120,7 +120,10 @@ void Array<T, SIZE>::append(const T *begin, const T *end) {
// IntTraits is not specialized for integer types smaller than int,
// since these are promoted to int.
template <typename T>
struct IntTraits {};
struct IntTraits {
typedef T UnsignedType;
static bool IsNegative(T) { return false; }
};
template <typename T, typename UnsignedT>
struct SignedIntTraits {
......@@ -128,24 +131,12 @@ struct SignedIntTraits {
static bool IsNegative(T value) { return value < 0; }
};
template <typename T>
struct UnsignedIntTraits {
typedef T UnsignedType;
static bool IsNegative(T) { return false; }
};
template <>
struct IntTraits<int> : SignedIntTraits<int, unsigned> {};
template <>
struct IntTraits<unsigned> : UnsignedIntTraits<unsigned> {};
template <>
struct IntTraits<long> : SignedIntTraits<long, unsigned long> {};
template <>
struct IntTraits<unsigned long> : UnsignedIntTraits<unsigned long> {};
class ArgInserter;
class FormatterProxy;
}
......
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