is_floating_point 类

测试,如果是浮点类型。

template<class Ty>
    struct is_floating_point;

参数

  • Ty
    查询的类型。

备注

谓词应用类型的实例,如果类型 Ty 是浮点类型或浮点类型的 cv-qualified 形式,否则它对负错误。

浮点类型是一个 float、double或 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); 
    } 
 
  

要求

标头: <type_traits>

命名空间: std

请参见

参考

<type_traits>

is_integral 类

其他资源

type_traits 成员