is_floating_point Class

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Tests if type is floating point.

template <class Ty>  
struct is_floating_point;  

Parameters

Ty
The type to query.

An instance of the type predicate holds true if the type Ty is a floating point type or a cv-qualified form of a floating point type, otherwise it holds false.

A floating point type is one of float, double, or long double.

// std_tr1__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  

Header: <type_traits>

Namespace: std

<type_traits>
is_integral Class

Show: