std::error_condition::operator=
来自 cppreference.cn
< cpp | error | error condition
template< class ErrorConditionEnum > error_condition& operator=( ErrorConditionEnum e ) noexcept; |
(1) | (自 C++11 起) |
error_condition& operator=( const error_condition& other ) = default; |
(2) | (自 C++11 起) (隐式声明) |
error_condition& operator=( error_condition&& other ) = default; |
(3) | (自 C++11 起) (隐式声明) |
将内容赋值给错误条件。
1) 为枚举
e
赋值错误条件。 有效地调用 make_error_condition
,该函数仅通过实参依赖查找 для e
找到,然后用结果替换 *this。 仅当 std::is_error_condition_enum<ErrorConditionEnum>::value 为 true 时,此重载才参与重载解析。2,3) 隐式定义的复制赋值运算符和移动赋值运算符将
other
的内容赋值给 *this。[编辑] 参数
e | - | 错误条件枚举 |
other | - | 另一个要赋值的错误条件 |
[编辑] 返回值
*this.
[编辑] 缺陷报告
以下行为变更缺陷报告被追溯应用于先前发布的 C++ 标准。
DR | 应用于 | 已发布行为 | 正确行为 |
---|---|---|---|
LWG 3629 | C++11 | 仅使用 std::make_error_condition 重载 |
使用 ADL 找到的重载 |