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

来自cppreference.com
< 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)other*this

参数

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

返回值

*this

参阅

对复数运用一元运算符
(函数模板)
在两个复数,或一个复数与一个标量上进行复数算术运算
(函数模板)