Namespaces
Variants

std::error_condition::error_condition

来自 zh.cppreference.net
 
 
 
 
 
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 起)
(隐式声明)

构造新的 error condition。

1) 默认构造函数。以通用类别和错误值 0 初始化 error condition。
2) 以错误值 val 和错误类别 cat 初始化 error condition。
3) 以枚举 e 初始化 error condition。效果上调用 make_error_condition,该函数仅通过 实参依赖查找 为 e 找到。此重载仅当 std::is_error_condition_enum<ErrorConditionEnum>::value 为 true 时参与重载决议。
4,5) 隐式定义的复制构造函数和移动构造函数。以 other 的内容初始化 error condition。

参数

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

缺陷报告

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

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

另请参阅

为 errc 值创建错误条件e
(函数)
构造一个 iostream 错误条件
(函数)
构造一个 futureerror_condition
(函数)