std::complex<T>:: operator+=,-=,*=,/=
From cppreference.net
|
主模板
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
另请参阅
|
对复数应用一元运算符
(函数模板) |
|
|
对两个复数值或复数与标量执行复数算术运算
(函数模板) |