std::meta::is_enum_type
Defined in header <meta> | ||
|---|---|---|
consteval bool is_enum_type( std::meta::info r ); | (since C++26) |
Returns true if r represents an enumeration type. Otherwise returns false.
Parameters
| r | - | a reflection value |
Return value
true if r represents an enumeration type; otherwise false.
Exceptions
Throws std::meta::exception if r does not represent a type or type alias.
Example
#include <meta>
enum A { e };
enum class B { e };
enum class C : int { e };
static_assert
(""
&& is_enum_type(^^A)
&& is_enum_type(^^B)
&& ! std::meta::is_arithmetic_type(^^A)
&& ! std::meta::is_arithmetic_type(^^B)
&& ! std::meta::is_arithmetic_type(^^C)
&& ! std::meta::is_integral_type(^^C)
&& ! std::meta::is_enumerator(^^A)
&& ! std::meta::is_enumerator(^^B)
&& std::meta::is_enumerator(^^e)
&& std::meta::is_enumerator(^^B::e)
&& std::meta::is_scalar_type(^^A)
&& std::meta::is_scalar_type(^^B)
&& std::meta::is_scalar_type(^^C)
);
int main() {}
See also
|
(C++26) | checks if reflection represents an enumerator (function) |
|
(C++26) | checks if reflection represents a scoped enumeration type (function) |
|
(C++26) | checks if reflected type is a scalar type (function) |
|
(C++26) | checks if reflected type is an integral type (function) |
|
(C++26) | checks if reflection represents an arithmetic type (function) |
|
(C++11) | checks if a type is an enumeration type (class template) |
|
(C++23) | checks if a type is a scoped enumeration type (class template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/is_enum_type