命名空间
变体
操作

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

来自 cppreference.cn
< cpp‎ | numeric‎ | complex
 
 
 
 
主模板 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

[edit] 参数

other - 匹配类型的复数或标量值 (floatdoublelong double)

[edit] 返回值

*this

[edit] 参见

将一元运算符应用于复数
(函数模板) [编辑]
对两个复数值或一个复数和一个标量执行复数算术
(函数模板) [编辑]