Spec-Zone.ru › C++

std::meta::is_floating_point_type

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, longdouble, 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

is_arithmetic_type
(C++26)
checks if reflection represents an arithmetic type
(function)
is_fundamental_type
(C++26)
checks if reflection represents a fundamental type
(function)
is_scalar_type
(C++26)
checks if reflected type is a scalar type
(function)
is_floating_point
(C++11)
checks if a type is a floating-point type
(class template)
is_arithmetic
(C++11)
checks if a type is an arithmetic type
(class template)
floating_point
(C++20)
specifies that a type is a floating-point type
(concept)
is_iec559
[static]
identifies the IEC 559/IEEE 754 floating-point types
(public static member constant of std::numeric_limits<T>)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/meta/is_floating_point_type

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API