diff --git a/types/traits.hpp b/types/traits.hpp index 4c47e119..b711fd66 100644 --- a/types/traits.hpp +++ b/types/traits.hpp @@ -60,6 +60,17 @@ template <> struct try_unsigned { typedef double type; }; template <> struct try_unsigned { typedef float type; }; +///---------------------------------------------------------------------------- +/// find the signed version of a type if one exists +template +struct try_signed +{ + typedef typename std::make_signed::type type; +}; + +template <> struct try_signed { typedef double type; }; +template <> struct try_signed { typedef float type; }; + ///---------------------------------------------------------------------------- /// checks if a type can be converted in all cases without modification template struct is_lossless_cast : std::enable_if<