std::meta::is_fundamental_type
From cppreference.com
| Defined in header <meta>
|
||
consteval bool is_fundamental_type( std::meta::info r );
|
(since C++26) | |
Returns true if r represents a fundamental type (that is, an arithmetic type, void, std::nullptr_t, std::meta::info). Otherwise returns false.
Parameters
| r | - | a reflection value |
Return value
true if r represents a fundamental type; otherwise false.
Exceptions
Throws std::meta::exception if r does not represent a type or type alias.
Example
Run this code
#include <cstddef>
#include <meta>
class A {};
static_assert
(""
and is_fundamental_type(^^int) == true
and is_fundamental_type(^^int&) == false
and is_fundamental_type(^^int*) == false
and is_fundamental_type(^^void) == true
and is_fundamental_type(^^void*) == false
and is_fundamental_type(^^float) == true
and is_fundamental_type(^^float&) == false
and is_fundamental_type(^^float*) == false
and is_fundamental_type(^^std::nullptr_t) == true
and is_fundamental_type(^^A) == false
and is_fundamental_type(^^decltype(^^::)) == true
and is_fundamental_type(^^std::meta::info) == true
);
int main() {}
See also
(C++26) |
checks if reflection represents an arithmetic type (function) |
(C++26) |
checks if reflected type is a compound type (function) |
(C++26) |
checks if reflected type is void (function) |
(C++26) |
checks if reflected type is std::nullptr_t (function) |
(C++26) |
checks if reflected type is std::meta::info (function) |
(C++11) |
checks if a type is a fundamental type (class template) |