在线文档教程
C++
输入/输出 | Input/output

std::make_error_condition(std::io_errc)

STD:使[医]误差[医]条件%28 std::io[医]ERRC%29

Defined in header
std::error_condition make_error_condition( std::io_errc e (since C++11)

构造一个std::error_condition从类型的值中提取std::io_errc好像returnstd::error_condition(static_cast<int>(e),std::iostream_category())...

参数

e-error code number

返回值

类型值std::error_condition保存错误代码号的e与错误类别关联"iostream"...

例外

noexcept规格:

noexcept

二次

#include <iostream> #include <system_error> #include <string> 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"

二次

另见

error_condition (C++11)holds a portable error code (class)
io_errc (C++11)the IO stream error codes (enum)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/io/io[医]ERRC/Make[医]误差[医]条件