underflow_error 類別
類別會針對所有例外狀況的基底類別報告算術反向溢位。
class underflow_error : public runtime_error {
public:
explicit underflow_error(const string& message);
explicit underflow_error(const char *message);
};
備註
範例
// underflow_error.cpp
// compile with: /EHsc /GR
#include <iostream>
using namespace std;
int main( )
{
try
{
throw underflow_error( "The number's a bit small, captain!" );
}
catch ( exception &e ) {
cerr << "Caught: " << e.what( ) << endl;
cerr << "Type: " << typeid( e ).name( ) << endl;
};
}
需求
Header: <stdexcept>
命名空間: std