std::meta::make_signed
| Defined in header <meta>
|
||
consteval std::meta::info make_signed( std::meta::info r );
|
(since C++26) | |
Returns a reflection of the corresponding signed type S for integral type T, where T is represented by r.
If T is an integral (except bool) or enumeration type, then S is the signed integer type corresponding to T, with the same cv-qualifiers.
If T is signed or unsigned char, short, int, long, long long, then S is the signed type from this list corresponding to T.
If T is an enumeration type or char, wchar_t, char8_t, char16_t, char32_t, then S is the signed 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_signed_t<T>);.
Parameters
| r | - | a reflection value |
Return value
A reflection of the signed type S 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 : unsigned short {};
static_assert
(""
&& (make_signed(^^unsigned char) == ^^signed char)
&& (make_signed(^^unsigned int) == ^^signed int)
&& (make_signed(^^volatile unsigned long) == ^^volatile signed long)
&& (make_signed(^^E) == ^^signed short)
);
int main() {}
See also
(C++26) |
checks if reflection represents a signed arithmetic type (function) |
(C++26) |
checks if reflection represents an unsigned arithmetic type (function) |
(C++26) |
returns the corresponding unsigned type for reflected integral type (function) |
(C++11) |
obtains the corresponding signed type for the given integral type (class template) |