std::future_error
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
Defined in header <future>
|
||
class future_error; |
(C++11およびそれ以降) | |
クラスstd::future_errorは非同期実行し、共有状態(std::future、std::promiseなど)を扱っているスレッドライブラリの関数で失敗した場合にスローされる例外オブジェクトを定義します。 std::system_errorと同様に、この例外がstd::error_codeと互換性のあるエラーコードを運ぶ.
Original:
The class std::future_error defines an exception object that is thrown on failure by the functions in the thread library that deal with asynchronous execution and shared states (std::future, std::promise, etc). Similar to std::system_error, this exception carries an error code compatible with std::error_code.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集] メンバ関数
std::future_error オブジェクトを作成しますOriginal: creates a std::future_error objectThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
エラーコードを返します Original: returns the error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
エラーコードに固有の説明の文字列を返します Original: returns the explanatory string specific to the error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) |
Inherited from std::logic_error
Inherited from std::exception
Member functions
[仮想] |
例外オブジェクトを破棄します Original: destructs the exception object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (仮想パブリックメンバ関数of std::exception )
|
[仮想] |
説明文字列を返します Original: returns an explanatory string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (仮想パブリックメンバ関数of std::exception )
|
[編集] 例
このコードを実行します
#include <future> #include <iostream> int main() { std::future<int> empty; try { int n = empty.get(); } catch (const std::future_error& e) { std::cout << "Caught a future_error with code \"" << e.code() << "\"\nMessage: \"" << e.what() << "\"\n"; } }
出力:
Caught a future_error with code "future:3" Message: "No associated state"
[編集] 参照
(C++11) |
将来のエラー·コードを識別します Original: identifies the future error codes The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (列挙) |