名前空間
変種
操作

std::experimental::bad_any_cast

From cppreference.com
< cpp‎ | experimental‎ | any
 
 
 
 
 
ヘッダ<experimental/any>で定義
class bad_any_cast : public std::bad_cast;
(Library Fundamentals TS)

失敗時にstd::experimental::any_castの値が返される形式によってスローされるオブジェクトの型を定義します。

目次

[編集] メンバ関数

(コンストラクタ)
新しいbad_any_castオブジェクトを構築します
(public member function)
operator=
bad_any_castオブジェクトを置き換えます
(public member function)
what
説明文字列を返す
(public member function)

std::experimental::bad_any_cast::bad_any_cast

bad_any_cast() noexcept;
(1) (Library Fundamentals TS)
bad_any_cast( const bad_any_cast& other ) noexcept;
(2) (Library Fundamentals TS)

what()からアクセス可能な、実装定義されたヌル終端バイト文字列を持つ新しいbad_any_castオブジェクトを構築します。

1) デフォルトコンストラクタ。
2) コピーコンストラクタ。 *thisother が両方とも動的型std::experimental::bad_any_cast を持つ場合、 std::strcmp(what(), other.what()) == 0 です。

パラメータ

その他 - コピーする別の例外オブジェクト

std::experimental::bad_any_cast::operator=

bad_any_cast& operator=( const bad_any_cast& other ) noexcept;
(Library Fundamentals TS)

other の内容で代入します。 *thisother が両方とも動的型std::experimental::bad_any_cast を持つ場合、代入後、 std::strcmp(what(), other.what()) == 0 になります。

パラメータ

その他 - 割り当てる別の例外オブジェクト

戻り値

*this

std::experimental::bad_any_cast::what

virtual const char* what() const noexcept;
(Library Fundamentals TS)

説明文字列を返します。

戻り値

説明情報を含む、実装定義のヌル終端文字列へのポインタ。この文字列は std::wstring として変換および表示するのに適しています。このポインタは、それが取得された例外オブジェクトが破棄されるか、例外オブジェクトの非 const メンバー関数(例:コピー代入演算子)が呼び出されるまで、少なくとも有効であることが保証されます。

返された文字列は、定数評価中に通常のリテラルエンコーディングでエンコードされます。

(C++26以降)

注釈

実装は what() をオーバーライドすることが許可されていますが、必須ではありません。

std::bad_castから継承

std::exception から継承

メンバ関数

例外オブジェクトを破棄する
(std::exception の仮想 public メンバー関数) [編集]
[virtual]
説明文字列を返す
(std::exception の仮想 public メンバー関数) [編集]
English 日本語 中文(简体) 中文(繁體)