std::meta::is_class_type
From cppreference.com
| Defined in header <meta>
|
||
consteval bool is_class_type( std::meta::info r );
|
(since C++26) | |
Returns true if r represents a non-union class type. Otherwise returns false.
Parameters
| r | - | a reflection value |
Return value
true if r represents a non-union class type; otherwise false.
Exceptions
Throws std::meta::exception if r does not represent a type or type alias.
Example
Run this code
#include <meta>
struct S {};
static_assert(!is_union_type(^^S));
static_assert(is_class_type(^^S));
union U
{
int a;
float b;
};
static_assert(is_union_type(^^U));
static_assert(!is_class_type(^^U));
struct C { U u; };
static_assert(!is_union_type(^^C));
static_assert(is_class_type(^^C));
static_assert(!is_class_type(^^int));
static_assert(is_class_type(^^struct I), "incomplete class");
static_assert(is_class_type(^^class II), "incomplete class");
static_assert(is_class_type(^^decltype([]{})));
int main() {}
See also
(C++26) |
checks if reflected type is a union type (function) |
(C++11) |
checks if a type is a non-union class type (class template) |
(C++11) |
checks if a type is a union type (class template) |