Namespaces
Variants

std::meta::is_integral_type

From cppreference.com
< cpp | meta
 
 
 
Reflection library
 
Reflection types and queries
Type properties
Type property queries
 
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

#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

checks if reflection represents an arithmetic type
(function) [edit]
checks if reflected type is a floating-point type
(function) [edit]
checks if reflection represents a fundamental type
(function) [edit]
checks if reflected type is a scalar type
(function) [edit]
(C++20)
specifies that a type is an integral type
(concept) [edit]
[static]
identifies integer types
(public static member constant of std::numeric_limits<T>) [edit]
checks if a type is an integral type
(class template) [edit]
checks if a type is a floating-point type
(class template) [edit]
checks if a type is an arithmetic type
(class template) [edit]
(C++11)
checks if a type is an enumeration type
(class template) [edit]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.