Namespaces
Variants

std::meta::is_floating_point_type

From cppreference.com
< cpp | meta
 
 
 
Reflection library
 
Reflection types and queries
Type properties
Type property queries
 
Defined in header <meta>
consteval bool is_floating_point_type( std::meta::info r );
(since C++26)

Returns true if r represents a floating-point type, that is, any of float, double, long double, or any extended floating-point types (std::float16_t, std::float32_t, std::float64_t, std::float128_t, or std::bfloat16_t) and cv-qualified variants. Otherwise returns false.

Parameters

r - a reflection value

Return value

true if r represents a floating-point type; otherwise false.

Exceptions

Throws std::meta::exception if r does not represent a type or type alias.

Example

#include <meta>
#include <stdfloat>

class A {};
static_assert(!is_floating_point_type(^^A));

static_assert( is_floating_point_type(^^float));
static_assert(!is_floating_point_type(^^float&));
static_assert( is_floating_point_type(add_cv(^^double)));
static_assert(!is_floating_point_type(^^double&));
static_assert(!is_floating_point_type(^^long));

#if __STDCPP_FLOAT64_T__ == 1
static_assert(is_floating_point_type(^^std::float64_t));
#endif

int main() {}

See also

checks if reflection represents an arithmetic type
(function) [edit]
checks if reflection represents a fundamental type
(function) [edit]
checks if reflected type is a scalar type
(function) [edit]
checks if a type is a floating-point type
(class template) [edit]
checks if a type is an arithmetic type
(class template) [edit]
specifies that a type is a floating-point type
(concept) [edit]
[static]
identifies the IEC 559/IEEE 754 floating-point types
(public static member constant of std::numeric_limits<T>) [edit]