std::meta::is_integral_type
From cppreference.com
| Defined in header <meta>
|
||
consteval bool is_integral_type( std::meta::info r );
|
(since C++26) | |
Returns true if r represents an integral type, that is, any of bool, char, char8_t, char16_t, char32_t, wchar_t, short, int, long, long long, or any implementation-defined extended integer types, including any signed, unsigned, and cv-qualified variants. Otherwise returns false.
Parameters
| r | - | a reflection value |
Return value
true if r represents an integral type; otherwise false.
Exceptions
Throws std::meta::exception if r does not represent a type or type alias.
Example
Run this code
#include <meta>
static_assert
(""
&& is_integral_type(^^float) == false
&& is_integral_type(^^int*) == false
&& is_integral_type(^^int) == true
&& is_integral_type(add_cv(^^long)) == true
&& is_integral_type(^^bool) == true
&& is_integral_type(^^char) == true
);
class A {};
static_assert(is_integral_type(^^A) == false);
struct B { int x: 4; };
static_assert(is_integral_type(^^B) == false);
using BF = decltype(B::x); // bit-field's type
static_assert(is_integral_type(^^BF) == true);
enum E : int {};
static_assert(is_integral_type(^^E) == false);
static_assert(is_integral_type(^^decltype(+[]{})) == false);
int main() {}
See also
(C++26) |
checks if reflection represents an arithmetic type (function) |
(C++26) |
checks if reflected type is a floating-point type (function) |
(C++26) |
checks if reflection represents a fundamental type (function) |
(C++26) |
checks if reflected type is a scalar type (function) |
(C++20) |
specifies that a type is an integral type (concept) |
[static] |
identifies integer types (public static member constant of std::numeric_limits<T>)
|
(C++11) |
checks if a type is an integral type (class template) |
(C++11) |
checks if a type is a floating-point type (class template) |
(C++11) |
checks if a type is an arithmetic type (class template) |
(C++11) |
checks if a type is an enumeration type (class template) |