std::error_code:: operator=
From cppreference.net
<
cpp
|
error
|
error code
C++
Utilities library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diagnostics library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::error_code
| Member functions | ||||
|
error_code::operator=
|
||||
| Modifiers | ||||
| Observers | ||||
| Non-member functions | ||||
|
(until C++20)
(until C++20)
(C++20)
|
||||
| Helper classes | ||||
|
template
<
class
ErrorCodeEnum
>
error_code & operator = ( ErrorCodeEnum e ) noexcept ; |
(1) | (自 C++11 起) |
|
error_code
&
operator
=
(
const
error_code
&
other
)
=
default
;
|
(2) |
(自 C++11 起)
(隐式声明) |
|
error_code
&
operator
=
(
error_code
&&
other
)
=
default
;
|
(3) |
(自 C++11 起)
(隐式声明) |
1)
将错误码及对应类别替换为表示错误码枚举
e
的内容。
等效于
*
this
=
make_error_code
(
e
)
,其中
make_error_code
仅通过
实参依赖查找
找到。
2,3)
隐式定义的复制赋值运算符和移动赋值运算符将
other
的内容赋值给
*
this
。
目录 |
参数
| e | - | 用于构造的错误代码枚举 |
| other | - | 用于赋值的另一个错误代码 |
返回值
* this
缺陷报告
下列行为变更缺陷报告被追溯应用于先前发布的 C++ 标准。
| 问题报告 | 应用于 | 发布时的行为 | 正确行为 |
|---|---|---|---|
| LWG 3629 | C++11 |
仅使用了
std::make_error_code
重载
|
使用ADL查找的重载 |
参见
|
分配另一个错误代码
(公开成员函数) |