std:: system_error
From cppreference.net
C++
Utilities library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diagnostics library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::system_error
|
定義先ヘッダ
<system_error>
|
||
|
class
system_error
;
|
(C++11以降) | |
std::system_error
は、様々なライブラリ関数(通常はOS機能とインターフェースする関数、例えば
std::thread
のコンストラクタなど)によってスローされる例外の型であり、この例外には関連する
std::error_code
があり、報告される可能性があります。
継承図
目次 |
メンバー関数
system_error
オブジェクトを構築する
(public member function) |
|
system_error
オブジェクトを置き換える
(public member function) |
|
|
エラーコードを返す
(public member function) |
|
|
[virtual]
|
説明文字列を返す
(virtual public member function) |
std::exception から継承
メンバ関数
|
[virtual]
|
例外オブジェクトを破棄
(
std::exception
の仮想公開メンバ関数)
|
|
[virtual]
|
説明文字列を返す
(
std::exception
の仮想公開メンバ関数)
|
例
このコードを実行
#include <iostream> #include <system_error> #include <thread> int main() { try { std::thread().detach(); // attempt to detach a non-thread } catch(const std::system_error& e) { std::cout << "Caught system_error with code " "[" << e.code() << "] meaning " "[" << e.what() << "]\n"; } }
出力例:
Caught system_error with code [generic:22] meaning [Invalid argument]