From 4899f087721bb640d6dcb9ecb12472112ac33a2c Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 25 May 2012 15:30:11 +1000 Subject: [PATCH] Add always_unsigned type conversion template --- types/traits.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/traits.hpp b/types/traits.hpp index e10b93c4..7280e061 100644 --- a/types/traits.hpp +++ b/types/traits.hpp @@ -40,4 +40,11 @@ template struct dereferenced_type> { typedef T t template struct dereferenced_type> { typedef T type; }; template struct dereferenced_type> { typedef T type; }; + +template struct always_unsigned { + typedef typename std::make_unsigned::type type; +}; +template <> struct always_unsigned { typedef double type; }; +template <> struct always_unsigned { typedef float type; }; + #endif