Namespaces
Variants

std::experimental:: bad_optional_access

From cppreference.net
ヘッダーで定義 <experimental/optional>
class bad_optional_access ;
(ライブラリファンダメンタルTS)

値が含まれていないoptionalオブジェクトにアクセスした際に、 std::experimental::optional::value によってスローされるオブジェクトの型を定義します。

cpp/error/exception cpp/error/logic error std-bad optional access-inheritance.svg

継承図

目次

メンバー関数

(constructor)
新しい bad_optional_access オブジェクトを構築する
(public member function)
operator=
bad_optional_access オブジェクトを置き換える
(public member function)
what
説明文字列を返す
(public member function)

std::experimental::bad_optional_access:: bad_optional_access

bad_optional_access ( ) noexcept ;
(1) (library fundamentals TS)
bad_optional_access ( const bad_optional_access & other ) noexcept ;
(2) (library fundamentals TS)

新しい bad_optional_access オブジェクトを構築します。実装定義のnull終端バイト文字列が含まれ、これは what() を通じてアクセス可能です。

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

パラメータ

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

std::experimental::bad_optional_access:: operator=

bad_optional_access & operator = ( const bad_optional_access & other ) noexcept ;
(library fundamentals TS)

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

パラメータ

other - 代入する別の例外オブジェクト

戻り値

* this

std::experimental::bad_optional_access:: what

virtual const char * what ( ) const noexcept ;
(library fundamentals TS)

説明文字列を返します。

戻り値

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

注記

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

std:: logic_error から継承

std::exception から継承 std:: exception

メンバ関数

例外オブジェクトを破棄
( std::exception の仮想publicメンバ関数)
[virtual]
説明文字列を返す
( std::exception の仮想publicメンバ関数)