Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

make_unsigned

template <class T>
struct make_unsigned
{
   typedef see-below type;
};

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.

Requires: T must be an integer or enumerated type, and must not be the type bool.

C++ Standard Reference: 3.9.1.

Compiler Compatibility: All current compilers are supported by this trait.

Header: #include <boost/type_traits/make_unsigned.hpp> or #include <boost/type_traits.hpp>

Table 1.24. Examples

Expression

Result Type

make_unsigned<int>::type

unsigned int

make_unsigned<unsigned int const>::type

unsigned int const

make_unsigned<const unsigned long long>::type

const unsigned long long

make_unsigned<my_enum>::type

An unsigned integer type with the same width as the enum.

make_unsigned<wchar_t>::type

An unsigned integer type with the same width as wchar_t.



PrevUpHomeNext