std::exception::operator=
来自 cppreference.cn
exception& operator=( const exception& other ) throw(); |
(C++11 前) | |
exception& operator=( const exception& other ) noexcept; |
(C++11 起) (C++26 起为 constexpr) |
|
复制赋值运算符。赋值 other 的内容。
若 *this 与 other 均拥有动态类型 std::exception
,则赋值后 std::strcmp(what(), other.what()) == 0 。
[编辑] 参数
其他 | - | 另一个异常,用于赋值其内容 |
[编辑] 缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
缺陷报告 | 应用于 | 发布时的行为 | 正确的行为 |
---|---|---|---|
LWG 471 | C++98 | 赋值后调用 what() 的效果是 实现定义的 |
若动态类型相同,则要求与原先的 what() 相同 |