std::complex<T>::operator=
來自 cppreference.com
| 所有特化 |
||
| (1) | ||
complex& operator=( const complex& cx ); |
(C++20 前) | |
| constexpr complex& operator=( const complex& cx ); |
(C++20 起) | |
| (2) | ||
template< class X > complex& operator=( const std::complex<X>& cx ); |
(C++20 前) | |
| template< class X > constexpr complex& operator=( const std::complex<X>& cx ); |
(C++20 起) | |
| 主模板 complex<T> |
||
| (3) | ||
complex& operator=( const T& x ); |
(C++20 前) | |
| constexpr complex& operator=( const T& x ); |
(C++20 起) | |
| 標準浮點型別 complex<F> 的特化 (直至 C++23) |
||
| (3) | ||
complex& operator=( F x ); |
(C++20 前) | |
| constexpr complex& operator=( F x ); |
(C++20 起) (直至 C++23) |
|
為內容賦值新值。
3) 將 x 賦值給複數的實部。虛部被設定為零。
目錄 |
[編輯] 引數
| x | - | 要賦的值 |
| cx | - | 要賦值的複數值 |
[編輯] 返回值
*this
[編輯] 注意
從 C++23 起,複製賦值運算子必須是平凡的,但實現通常在所有模式下都使其平凡。
[編輯] 缺陷報告
下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。
| 缺陷報告 | 應用於 | 釋出時的行為 | 正確的行為 |
|---|---|---|---|
| LWG 3935 | C++98 | 缺少過載 (2) 的描述 | 已新增 |
[編輯] 另請參閱
| 構造一個複數 (公共成員函式) | |
| 表示純虛數的 std::complex 字面量 (函式) |