Namespaces
Variants

std::error_condition::operator=

来自 zh.cppreference.net
 
 
 
 
 
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++标准。

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