Namespaces
Variants

std::complex<T>:: operator+=,-=,*=,/=

From cppreference.net
<tr class="t
主模板 complex<T>
(1)
complex & operator + = ( const T & other ) ;
(C++20 前)
constexpr complex & operator + = ( const T & other ) ;
(C++20 起)
(2)
complex & operator - = ( const T & other ) ;
(C++20 前)
constexpr complex & operator - = ( const T & other ) ;
(C++20 起)
(3)
complex & operator * = ( const T & other ) ;
(C++20 前)
constexpr complex & operator * = ( const T & other ) ;
(C++20 起)
(4)
complex & operator / = ( const T & other ) ;
(C++20 前)
constexpr complex & operator / = ( const T & other ) ;
(C++20 起)
特化 complex<float>
(1)
complex & operator + = ( float other ) ;
(C++20 前)
constexpr complex & operator + = ( float other ) ;
(C++20 起)
(2)
complex & operator - = ( float other ) ;
(C++20 前)
constexpr complex & operator - = ( float other ) ;
(C++20 起)
(3)
complex & operator * = ( float other ) ;
(C++20 前)
constexpr complex & operator * = ( float other ) ;
(C++20 起)
(4)
complex & operator / = ( float other ) ;
(C++20 前)
constexpr complex & operator / = ( float other ) ;
(C++20 起)
特化 complex<double>
(1)
complex & operator + = ( double other ) ;
(C++20 前)
constexpr complex & operator + = ( double other ) ;
(C++20 起)
(2)
complex & operator - = ( double other ) ;
(C++20 前)
constexpr complex & operator - = ( double other ) ;
(C++20 起)

实现复合赋值运算符,用于复数运算以及复数/标量混合运算。标量参数将被视为复数,其实部等于参数值,虚部设为零。

1,5) other 添加至 * this
2,6) * this 中减去 other
3,7) * this 乘以 other
4,8) * this 除以 other

参数

其他 - 匹配类型的复数或标量值( float , double , long double

返回值

* this

参见

对复数应用一元运算符
(函数模板)
对两个复数或复数与标量执行复数算术运算
(函数模板)