std::meta::is_floating_point_type
From cppreference.com
| 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
Run this code
#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
(C++26) |
checks if reflection represents an arithmetic type (function) |
(C++26) |
checks if reflection represents a fundamental type (function) |
(C++26) |
checks if reflected type is a scalar type (function) |
(C++11) |
checks if a type is a floating-point type (class template) |
(C++11) |
checks if a type is an arithmetic type (class template) |
(C++20) |
specifies that a type is a floating-point type (concept) |
[static] |
identifies the IEC 559/IEEE 754 floating-point types (public static member constant of std::numeric_limits<T>)
|