Namespaces
Variants

std::exception::operator=

来自 zh.cppreference.net
 
 
 
 
 
exception& operator=( const exception& other ) throw();
(直到 C++11)
exception& operator=( const exception& other ) noexcept;
(自 C++11 起)
(constexpr 自 C++26 起)

复制赋值运算符。将 other 的内容赋值。

如果 *this 和 other 都具有动态类型 std::exception,则在赋值后 std::strcmp(what(), other.what()) == 0。

参数

其他 - 另一个用于分配内容异常的

缺陷报告

以下行为变更缺陷报告被追溯应用于先前发布的C++标准。

DR 适用范围 发布时的行为 正确行为
LWG 471 C++98 赋值后调用 what() 的效果
由实现定义
要求与原始 what() 相同
(当动态类型一致时)