最終更新日時:
が更新

履歴 編集

function
<exception>

std::exception::what

virtual const char* what() const;                     // (1) C++98
virtual const char* what() const noexcept;            // (1) C++11
const char* what() const noexcept override;           // (1) C++17
constexpr const char* what() const noexcept override; // (1) C++26

概要

エラー理由となる実装依存文字列を取得する。

戻り値

処理系定義のNULL終端マルチバイト文字列へのポインタを返す。

返されたポインタの指す文字列は、それを取得した例外オブジェクトを破棄するか、その例外オブジェクトに対して非constなメンバ関数を呼び出すまで有効である。

例外

投げない

備考

  • C++11 : 動的な型が同じTである2つのオブジェクトlhsrhsについて、lhsrhsのコピーである場合、std::strcmp(lhs.what(), rhs.what()) == 0が成り立つ
    • この事後条件は、exceptionから派生する標準ライブラリのクラスすべてに要求される

関連項目

参照