Namespaces
Variants

std::exception:: operator=

From cppreference.net
Utilities library
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++标准。

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