名稱空間
變體
操作

std::error_code::operator=

來自 cppreference.com
< cpp‎ | 錯誤‎ | 錯誤碼
 
 
 
 
 
template< class ErrorCodeEnum >
error_code& operator=( ErrorCodeEnum e ) noexcept;
(1) (C++11 起)
error_code& operator=( const error_code& other ) = default;
(2) (C++11 起)
(隱式宣告)
error_code& operator=( error_code&& other ) = default;
(3) (C++11 起)
(隱式宣告)
1) 將錯誤碼和對應的類別替換為表示錯誤碼列舉 e 的那些。

等價於 *this = make_error_code(e),其中 make_error_code 僅透過實參依賴查詢找到。

此過載僅當 std::is_error_code_enum<ErrorCodeEnum>::valuetrue 時才參與過載決議。
2,3) 隱式定義的複製賦值運算子和移動賦值運算子將 other 的內容賦給 *this

目錄

[編輯] 引數

e - 要構造的錯誤碼列舉
其他 - 另一個要賦值的錯誤碼

[編輯] 返回值

*this

[編輯] 缺陷報告

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

缺陷報告 應用於 釋出時的行為 正確的行為
LWG 3629 C++11 只使用了 std::make_error_code 過載 使用了 ADL 找到的過載

[編輯] 參閱

賦值另一個錯誤碼
(public member function) [編輯]