std::make_signed that accepts floating point types
13:13 04 May 2013

I have a templated class that can only be instantiated for scalar types (integers, floats, etc.) and I want a member typedef to always be the signed variant of the type. That is:

unsigned int -> signed int
signed long long -> signed long long (already signed)
unsigned char -> signed char
float -> float
long double -> long double
etc...

Unfortunately, std::make_signed only works for integral types, not the floating point types. What is the simplest way to do this? I'm looking for something of the form using SignedT = ...;, to be part of my templated class with template parameter T already guaranteed to be scalar.

c++ templates c++11 type-traits