std::make_exception_ptr
From cppreference.com
| ヘッダー <exception> で定義 |
||
template< class E > std::exception_ptr make_exception_ptr( E e ) noexcept; |
(C++11以降) (C++26 以降 constexpr) |
|
std::exception_ptr を作成し、e のコピーへの参照を保持します。これは、以下のコードを実行するのと同等です。
try { throw e; } catch(...) { return std::current_exception(); }
目次 |
[編集] パラメータ
| e | - | コピー元の例外オブジェクト |
[編集] 戻り値
e のコピーへの参照を保持する std::exception_ptr のインスタンス。または、std::bad_alloc のインスタンス、あるいは std::bad_exception のインスタンス(std::current_exception を参照)。
[編集] 注記
パラメータは値渡しされ、スライシングの対象となります。
| 機能テストマクロ | 値 | 規格 | 機能 |
|---|---|---|---|
__cpp_lib_constexpr_exceptions |
202411L |
(C++26) | constexpr for exception types |
[編集] 例
| このセクションは未完成です 理由: 例がありません |
[編集] 関連項目
| (C++11) |
現在の例外を std::exception_ptr にキャプチャする (関数) |