Spec-Zone.ru › C++

std::meta::is_signed_type

Defined in header <meta>
consteval bool is_signed_type( std::meta::info r );
(since C++26)

Returns true if r is a reflection of a signed arithmetic type. Otherwise returns false.

Parameters

r - a reflection value

Return value

true if r represents a signed arithmetic type; otherwise false.

Exceptions

Throws std::meta::exception if r does not represent a type or type alias.

Example

#include <meta>

static_assert(""
    and is_signed_type(^^signed) == true
    and is_signed_type(^^unsigned) == false
    and is_signed_type(^^int) == true
    and is_signed_type(^^bool) == false
    and is_signed_type(^^float) == true
);

int main() {}

See also

is_unsigned_type
(C++26)
checks if reflection represents an unsigned arithmetic type
(function)
is_arithmetic_type
(C++26)
checks if reflection represents an arithmetic type
(function)
make_signed
(C++26)
returns the corresponding signed type for reflected integral type
(function)
is_signed
(C++11)
checks if a type is a signed arithmetic type
(class template)
is_arithmetic
(C++11)
checks if a type is an arithmetic type
(class template)
make_signed
(C++11)
obtains the corresponding signed type for the given integral type
(class template)
is_signed
[static]
identifies signed types
(public static member constant of std::numeric_limits<T>)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/is_signed_type

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API