Share via


is_floating_point-Klasse

Testet, ob es sich beim Typ um ein Gleitkomma handelt.

Syntax

template <class Ty>
struct is_floating_point;

Parameter

Ty
Der abzufragende Typ.

Hinweise

Eine Instanz des Typprädikats "true", wenn der Typ "Ty" ein Gleitkommatyp oder eine cv-qualified Form eines Gleitkommatyps ist, andernfalls "false".

Ein Gleitkommatyp ist einer von float, double oder long double.

Beispiel

// std__type_traits__is_floating_point.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>

struct trivial
    {
    int val;
    };

int main()
    {
    std::cout << "is_floating_point<trivial> == " << std::boolalpha
        << std::is_floating_point<trivial>::value << std::endl;
    std::cout << "is_floating_point<int> == " << std::boolalpha
        << std::is_floating_point<int>::value << std::endl;
    std::cout << "is_floating_point<float> == " << std::boolalpha
        << std::is_floating_point<float>::value << std::endl;

    return (0);
    }
is_floating_point<trivial> == false
is_floating_point<int> == false
is_floating_point<float> == true

Anforderungen

Header:<type_traits>

Namespace: std

Siehe auch

<type_traits>
is_integral-Klasse