Namespaces
Variants

std::meta::is_scalar_type

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

#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

checks if reflection represents an arithmetic type
(function) [edit]
checks if reflected type is an enumeration type
(function) [edit]
checks if reflected type is a pointer type
(function) [edit]
checks if reflection represents a member pointer type
(function) [edit]
checks if reflected type is std::nullptr_t
(function) [edit]
checks if reflected type is std::meta::info
(function) [edit]
checks if reflected type is an object type
(function) [edit]
(C++11)
checks if a type is a scalar type
(class template) [edit]