如果类型具有一个整数表示,测试。
static const bool is_integer = false;
返回值
true,如果该类型具有一个整数表示; false,如果没有。
备注
所有预定义的整数类型都有一个整数表示。
示例
// numeric_limits_is_integer.cpp
// compile with: /EHsc
#include <iostream>
#include <limits>
using namespace std;
int main( )
{
cout << "Whether float objects have an integral representation: "
<< numeric_limits<float>::is_integer
<< endl;
cout << "Whether double objects have an integral representation: "
<< numeric_limits<double>::is_integer
<< endl;
cout << "Whether int objects have an integral representation: "
<< numeric_limits<int>::is_integer
<< endl;
cout << "Whether unsigned char objects have an integral representation: "
<< numeric_limits<unsigned char>::is_integer
<< endl;
}
要求
标头: <limits>
命名空间: std