Namespaces
Variants

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

From cppreference.net
(注:由于提供的HTML片段中不包含任何需要翻译的文本内容,所有标签均为结构标记且无文本节点,因此输出保持原样。若后续有需要翻译的文本内容,将严格遵循不翻译HTML标签/属性、代码块及C++专业术语的要求进行处理。)
主模板 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 起)
(3)
complex & operator * = ( double other ) ;
(C++20 前)
constexpr complex & operator * = ( double other ) ;
(C++20 起)
(4)
complex & operator / = ( double other ) ;
(C++20前)
constexpr complex & operator / = ( double other ) ;
(C++20起)
特化 complex<long double>
(1)
complex & operator + = ( long double other ) ;
(C++20 前)
constexpr complex & operator + = ( long double other ) ;
(C++20 起)
(2)
complex & operator - = ( long double other ) ;
(C++20 前)
constexpr complex & operator - = ( long double other ) ;
(C++20 起)
(3)
complex & operator * = ( long double other ) ;
(C++20 前)
constexpr complex & operator * = ( long double other ) ;
(C++20 起)
(4)
complex & operator / = ( long double other ) ;
(C++20 前)
constexpr complex & operator / = ( long double other ) ;
(C++20 起)
所有特化版本
(5)
template < class X >
complex & operator + = ( const std:: complex < X > & other ) ;
(C++20前)
template < class X >
constexpr complex & operator + = ( const std:: complex < X > & other ) ;
(C++20起)
(6)
template < class X >
complex & operator - = ( const std:: complex < X > & other ) ;
(C++20前)
template < class X >
constexpr complex & operator - = ( const std:: complex < X > & other ) ;
(C++20起)
(7)
template < class X >
complex & operator * = ( const std:: complex < X > & other ) ;
(C++20 前)
template < class X >
constexpr complex & operator * = ( const std:: complex < X > & other ) ;
(C++20 起)
(8)
template < class X >
complex & operator / = ( const std:: complex < X > & other ) ;
(C++20 前)
template < class X >
constexpr complex & operator / = ( const std:: complex < X > & other ) ;
(C++20 起)

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

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

参数

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

返回值

* this

另请参阅

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