I want to specialize a class template for char, short, long and long long. This specializations should also holds good for the signed and unsigned variants of the integral types.
I know boost library and std::tr1 / C++0x implements is_signed/is_unsigned and make_signed/make_unsigned type_traits. But how can I remove any signed specification from the char type (note: the only integral type where signed itype != itype)?
The “sign-ness” of
charis implementation defined. It doesn’t have to be able to store negative numbers. In strict standardese,chareven is never a signed integer type, even if it can store negative numbers on an implementation. Still, the class templateis_signedwill reporttrueforcharif it can store negative numbers, because that’s a useful thing for it to do.Anyway, the boost docs say the following about
make_unsigned, making it look like you can use it for your purpose.