std::error_condition::operator=

出自cppreference.com
 
 
 
 
 
template< class ErrorConditionEnum >
error_condition& operator=( ErrorConditionEnum e ) noexcept;
(1) (C++11 起)
error_condition& operator=( const error_condition& other ) = default;
(2) (C++11 起)
(隱式聲明)
error_condition& operator=( error_condition&& other ) = default;
(3) (C++11 起)
(隱式聲明)

賦值內容給錯誤條件。

1) 將枚舉 e 賦值給錯誤條件。實際上對 e 調用僅由實參依賴查找找到的 make_error_condition 然後再以結果替換 *this。此重載只有在 std::is_error_condition_enum<ErrorConditionEnum>::valuetrue 時才會參與重載決議。
2,3) 隱式定義的複製賦值運算符與移動賦值運算符將 other 的內容賦值給 *this

[編輯] 參數

e - 錯誤條件枚舉
other - 用以賦值的另一錯誤條件

[編輯] 返回值

*this

[編輯] 缺陷報告

下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。

缺陷報告 應用於 出版時的行為 正確行為
LWG 3629 C++11 僅使用 std::make_error_condition 重載 使用 ADL 所找到的重載