std::meta::make_unsigned
| Defined in header <meta>
|
||
consteval std::meta::info make_unsigned( std::meta::info r );
|
(since C++26) | |
Returns a reflection of the corresponding unsigned type U for integral type T, where T is represented by r.
If T is an integral (except bool) or enumeration type, then U is the unsigned integer type corresponding to T, with the same cv-qualifiers.
If T is signed or unsigned char, short, int, long, long long, then U is the unsigned type from this list corresponding to T.
If T is an enumeration type or char, wchar_t, char8_t, char16_t, char32_t, then U is the unsigned integer type with the smallest rank having the same sizeof as T.
Otherwise, the program is ill-formed.
Equivalent to return std::meta::dealias(^^std::make_unsigned_t<T>);.
Parameters
| r | - | a reflection value |
Return value
A reflection of the unsigned type U as described above.
Exceptions
Throws std::meta::exception if r does not represent enumeration or integral (except bool) type or type alias.
Example
#include <meta>
enum struct E : short {};
static_assert
(""
&& (make_unsigned(^^int) == ^^unsigned int)
&& (make_unsigned(^^signed char) == ^^unsigned char)
&& (make_unsigned(^^const long) == ^^const unsigned long)
&& (make_unsigned(^^volatile E) == ^^volatile unsigned short)
);
int main() {}
See also
(C++26) |
checks if reflection represents an unsigned arithmetic type (function) |
(C++26) |
checks if reflection represents a signed arithmetic type (function) |
(C++26) |
returns the corresponding signed type for reflected integral type (function) |
(C++11) |
obtains the corresponding unsigned type for the given integral type (class template) |