std::exception::operator=
来自cppreference.com
工具库
诊断库
|
|
std::exception
成员函数 | ||||
exception::operator=
|
||||
exception&
operator=(
const
exception&
other )
throw();
|
(C++11 前) | |
exception&
operator=(
const
exception&
other )
noexcept;
|
(C++11 起) | |
复制赋值运算符。赋值 other 的内容。
如果 *this 与 other
均拥有动态类型 std::exception
,那么赋值后 std::strcmp(what(),
other.what())
== 0。
参数
other | - | 要赋值内容的另一异常 |
缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
缺陷报告 | 应用于 | 出版时的行为 | 正确行为 |
---|---|---|---|
LWG 471 | C++98 | 赋值后调用 what() 的效果由实现定义 | 在动态类型相同时需要与原来的 what() 一致 |