std::bad_expected_access
From cppreference.com
| ヘッダ <expected> で定義 |
||
| template< class E > class bad_expected_access : public std::bad_expected_access<void> |
(1) | (C++23から) |
| template<> class bad_expected_access<void> : public std::exception |
(2) | (C++23から) |
1)
std::expected::value が、unexpected 値を保持している expected オブジェクトにアクセスした場合にスローされるオブジェクトの型を定義します。bad_expected_access<E> は unexpected 値のコピーを格納します。2)
bad_expected_access<void> は、他のすべての bad_expected_access の特殊化の基底クラスです。| このセクションは未完成です 理由: 継承図 |
目次 |
[編集] プライマリテンプレートのメンバー
| (コンストラクタ) |
bad_expected_access オブジェクトを構築します(public member function) |
| error |
格納された値を返します (public member function) |
| what |
説明文字列を返す (public member function) |
std::bad_expected_access::bad_expected_access
| explicit bad_expected_access( E e ); |
||
新しい bad_expected_access<E> オブジェクトを構築します。格納される値は std::move(e) で初期化されます。
std::bad_expected_access::error
| const E& error() const & noexcept; E& error() & noexcept; |
||
格納された値への参照を返します。
std::bad_expected_access::what
| const char* what() const noexcept override; |
||
説明文字列を返します。
パラメータ
(なし)
戻り値
説明的な情報を持つヌル終端文字列へのポインタ。この文字列は std::wstring への変換および表示に適しています。ポインタは、それが取得された例外オブジェクトが破棄されるまで、または例外オブジェクトに対して非 const メンバ関数(例: コピー代入演算子)が呼び出されるまで、少なくとも有効であることが保証されます。
注釈
実装は what() をオーバーライドすることが許可されていますが、必須ではありません。
[編集] bad_expected_access<void> 特殊化のメンバー
| (コンストラクタ) |
bad_expected_access<void> オブジェクトを構築します(protected メンバ関数) |
| (デストラクタ) |
bad_expected_access<void> オブジェクトを破棄します(protected メンバ関数) |
| operator= |
bad_expected_access<void> オブジェクトを置き換えます(protected メンバ関数) |
| what |
説明文字列を返す (public member function) |
bad_expected_access<void> の特殊メンバ関数は protected です。これらは派生クラスからのみ呼び出すことができます。
[編集] 例
| このセクションは未完成です 理由: 例がありません |