std::make_unsigned

Header: <type_traits>

If T is an integral (except bool) or enumeration type, provides the member typedef type which is the unsigned integer type corresponding to T, with the same cv-qualifiers.

# Declarations

template< class T >
struct make_unsigned;

(since C++11)

# Example

#include <type_traits>
 
int main()
{
    using uchar_type = std::make_unsigned_t<char>;
    using uint_type  = std::make_unsigned_t<int>;
    using ulong_type = std::make_unsigned_t<volatile long>;
 
    static_assert(
        std::is_same_v<uchar_type, unsigned char> and
        std::is_same_v<uint_type, unsigned int> and
        std::is_same_v<ulong_type, volatile unsigned long>
    );
}

# See also