std:: make_error_condition (std::io_errc)
|
定義済みヘッダー
<ios>
|
||
|
std::
error_condition
make_error_condition
(
std::
io_errc
e
)
noexcept
;
|
(C++11以降) | |
std::error_condition オブジェクトを std::io_errc 型の値から、以下のように構築します return std:: error_condition ( static_cast < int > ( e ) , std:: iostream_category ( ) ) 。
目次 |
パラメータ
| e | - | エラーコード番号 |
戻り値
std::error_condition 型の値で、 e からエラーカテゴリ "iostream" に関連付けられたエラーコード番号を保持します。
例
#include <iostream> #include <system_error> int main() { std::error_condition ec = std::make_error_condition(std::io_errc::stream); std::cout << "error condition for io_errc::stream has value " << ec.value() << "\nand message \"" << ec.message() << "\"\n"; }
出力:
error condition for io_errc::stream has value 1 and message "unspecified iostream_category error"
不具合報告
以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。
| DR | 適用対象 | 公開時の動作 | 正しい動作 |
|---|---|---|---|
| LWG 2087 | C++11 |
make_error_condition(io_errc)
が宣言されていなかった
noexcept
|
宣言されている noexcept |
関連項目
|
(C++11)
|
移植可能なエラーコードを保持する
(クラス) |
|
(C++11)
|
IOストリームのエラーコード
(列挙型) |