numeric_limits::traps

Tests whether trapping that reports on arithmetic exceptions is implemented for a type.

static const bool traps = false;

Return Value

true if trapping is implemented for the type; false if it is not.

Example

// 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;
}
Whether float types have implemented trapping: 1
Whether double types have implemented trapping: 1
Whether long int types have implemented trapping: 0
Whether unsigned char types have implemented trapping: 0

Requirements

Header: <limits>

Namespace: std

See Also

Reference

strstreambuf Class

Other Resources

numeric_limits Members