Namespaces
Variants

std::meta::is_union_type

From cppreference.com
< cpp | meta
 
 
 
Reflection library
 
Reflection types and queries
Type properties
Type property queries
 
Defined in header <meta>
consteval bool is_union_type( std::meta::info r );
(since C++26)

Returns true if r represents a union type. Otherwise returns false.

Parameters

r - a reflection value

Return value

true if r represents a union type; otherwise false.

Exceptions

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

Example

#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));

int main() {}

See also

checks if reflected type is a non-union class type
(function) [edit]
(C++11)
checks if a type is a union type
(class template) [edit]
(C++11)
checks if a type is a non-union class type
(class template) [edit]