CppDS.com

C++ 98 11 14 17 20 手册

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

参阅

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