numeric_limits::traps
測試是否截獲有關算術例外狀況的報告為型別所實作。
static const bool traps = false;
傳回值
true ,如果截獲對於這個型別會實作, false ,否則會傳回。
範例
// numeric_limits_traps.cpp
// compile with: /EHsc
#include <iostream>
#include <limits>
using namespace std;
int main( )
{
cout << "Whether float types have implemented trapping: "
<< numeric_limits<float>::traps
<< endl;
cout << "Whether double types have implemented trapping: "
<< numeric_limits<double>::traps
<< endl;
cout << "Whether long int types have implemented trapping: "
<< numeric_limits<long int>::traps
<< endl;
cout << "Whether unsigned char types have implemented trapping: "
<< numeric_limits<unsigned char>::traps
<< endl;
}
需求
標題: <limits>
命名空間: std