std::complex<T>::operator+=,-=,*=,/=
来自 cppreference.com
主模板 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 | - | 具有匹配类型(float、double、long double)的复数或标量值 |
[edit] 返回值
*this
[edit] 另请参阅
将一元运算符应用于复数 (函数模板) | |
对两个复数值或一个复数和一个标量执行复数运算 (函数模板) |