Share via


underflow_error クラス

このクラスは、算術アンダーフローを通知するためにスローされる例外すべてに対する基底クラスとして機能します。

構文

class underflow_error : public runtime_error {
public:
    explicit underflow_error(const string& message);

    explicit underflow_error(const char *message);

};

解説

what() によって返される値は message.data() のコピーです。 詳細については、次のトピックを参照してください。 what および data

underflow_error は、C++ 標準ライブラリの Microsoft 実装の関数によってスローされるのではなく、サードパーティのライブラリまたはユーザー コードによってスローされる可能性があります。

// underflow_error.cpp
// compile with: /EHsc
#include <exception>
#include <iostream>
#include <stdexcept>
#include <typeinfo>
using namespace std;

int main()
{
   try
   {
      throw underflow_error("The number's a bit small, captain!");
   }
   catch (const exception& e)
   {
      cerr << "Caught: " << e.what() << endl;
      cerr << "Type: " << typeid(e).name() << endl;
   }
}
/* Output:
Caught: The number's a bit small, captain!
Type: class std::underflow_error
*/

必要条件

ヘッダー:<stdexcept>

名前空間: std

関連項目

runtime_error クラス
C++ 標準ライブラリ内のスレッド セーフ