std::error_condition::operator=
来自cppreference.com
< cpp | error | error condition
工具库
诊断库
|
|
std::error_condition
成员函数 | ||||
error_condition::operator=
|
||||
非成员函数 | ||||
(C++20
前)(C++20
前)(C++20)
|
||||
辅助类 | ||||
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
赋值给错误条件。等效于对
e
调用仅由实参依赖查找找到的
make_error_condition
然后再以结果替换 *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 所找到的重载 |