std::exception::operator=

来自cppreference.com
< cpp‎ | error‎ | exception
 
 
 
 
 
exception& operator=( const exception& other ) throw();
(C++11 前)
exception& operator=( const exception& other ) noexcept;
(C++11 起)
(C++26 起为 constexpr)

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

如果 *thisother 均拥有动态类型 std::exception,那么赋值后 std::strcmp(what(), other.what()) == 0

参数

other-要赋值内容的另一异常

返回值

*this

缺陷报告

下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。

缺陷报告应用于出版时的行为正确行为
LWG 471C++98赋值后调用 what() 的效果由实现定义在动态类型相同时需要与原来的 what() 一致