How to get unsigned equivalent of an integral type in C++?
Boost.TypeTraits has make_unsigned
:
type: If T is a unsigned integer type then the same type as T, if T is an signed integer type then the corresponding unsigned type. Otherwise if T is an enumerated or character type (char or wchar_t) then an unsigned integer type with the same width as T.
If T has any cv-qualifiers then these are also present on the result type.
The source is much more than a handful of lines.