Namespaces
Variants

std::error_condition:: error_condition

From cppreference.net
Utilities library
error_condition ( ) noexcept ;
(1) (自 C++11 起)
error_condition ( int val, const error_category & cat ) noexcept ;
(2) (自 C++11 起)
template < class ErrorConditionEnum >
error_condition ( ErrorConditionEnum e ) noexcept ;
(3) (自 C++11 起)
error_condition ( const error_condition & other ) = default ;
(4) (自 C++11 起)
(隐式声明)
error_condition ( error_condition && other ) = default ;
(5) (自 C++11 起)
(隐式声明)

构造新的错误条件。

1) 默认构造函数。使用通用类别和错误值 0 初始化错误条件。
2) 使用错误值 val 和错误类别 cat 初始化错误条件。
3) 使用枚举值 e 初始化错误条件。该重载通过仅限对 e 进行 实参依赖查找 来有效调用 make_error_condition 。仅当 std:: is_error_condition_enum < ErrorConditionEnum > :: value true 时,此重载才会参与重载决议。
4,5) 隐式定义的复制构造函数和移动构造函数。使用 other 的内容初始化错误条件。

参数

other - 用于初始化的其他错误条件
val - 错误值
cat - 错误类别
e - 错误条件枚举

缺陷报告

以下行为变更缺陷报告被追溯应用于先前发布的C++标准。

缺陷报告 适用版本 发布时行为 正确行为
LWG 3629 C++11 仅使用了 std::make_error_condition 重载 使用ADL查找的重载

参见

errc e 创建错误条件
(函数)
构造输入输出流错误条件
(函数)
构造 future error_condition
(函数)