std::meta::is_scalar_type
From cppreference.com
| Defined in header <meta>
|
||
consteval bool is_scalar_type( std::meta::info r );
|
(since C++26) | |
Returns true if r represents a scalar type. Otherwise returns false.
Parameters
| r | - | a reflection value |
Return value
true if r represents a scalar 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>
enum E {};
struct S
{
int mem{};
int foo();
};
using mem_obj_ptr_t = int S::*;
using mem_fun_ptr_t = int (S::*)();
static_assert
(""
and is_scalar_type(^^E)
and ! is_scalar_type(^^S)
and is_scalar_type(^^int)
and ! is_scalar_type(^^int&)
and is_scalar_type(^^int*)
and ! is_scalar_type(^^void)
and is_scalar_type(^^void*)
and is_scalar_type(^^float)
and ! is_scalar_type(^^float&)
and is_scalar_type(^^float*)
and ! is_scalar_type(^^float[42])
and is_scalar_type(add_cv(^^int))
and is_scalar_type(^^mem_obj_ptr_t)
and is_scalar_type(^^mem_fun_ptr_t)
and is_scalar_type(^^std::nullptr_t)
and is_scalar_type(^^decltype(^^::))
and is_scalar_type(^^std::meta::info)
);
int main() {}
See also
(C++26) |
checks if reflection represents an arithmetic type (function) |
(C++26) |
checks if reflected type is an enumeration type (function) |
(C++26) |
checks if reflected type is a pointer type (function) |
(C++26) |
checks if reflection represents a member pointer type (function) |
(C++26) |
checks if reflected type is std::nullptr_t (function) |
(C++26) |
checks if reflected type is std::meta::info (function) |
(C++26) |
checks if reflected type is an object type (function) |
(C++11) |
checks if a type is a scalar type (class template) |