Namespaces
Variants

std::meta::is_fundamental_type

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

#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

checks if reflection represents an arithmetic type
(function) [edit]
checks if reflected type is a compound type
(function) [edit]
checks if reflected type is void
(function) [edit]
checks if reflected type is std::nullptr_t
(function) [edit]
checks if reflected type is std::meta::info
(function) [edit]
checks if a type is a fundamental type
(class template) [edit]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.