Complex Class Operators

Several assignment operators are overloaded for the complex class manipulations.

operator+=

Adds and assigns to a complex class.

 complex<T>& operator+=(const T&);
 template<class X> complex<T>& operator+=
 (const complex<X>&);
  
Remarks

The first operator with a scalar argument adds the scalar value of the right hand side to the real component and stores the result in the object. The imaginary component is left alone.

The second operator with a complex type, adds the complex value of the right hand side to the object and stores the result in the object.

The this pointer is returned.

operator-=
Subtracts and assigns from a complex class.
 complex<T>& operator-=(const T&);
 template<class X> complex<T>& operator-=
 (const complex<X>&);
 
Remarks

The first operator with a scalar argument subtracts the scalar value of the right hand side from the real component and stores the result in the object. The imaginary component is left alone.

The second operator with a complex type, subtracts the complex value of the right hand side from the object and stores the result in the object.

The this pointer is returned.

operator*=

Multiplies by and assigns to a complex class.

  complex<T>& operator*=(const T&);
  template<class X> complex<T>& operator*=
  (const complex<X>&);
  
Remarks

The first operator with a scalar argument multiplies the scalar value of the right hand side to class object and stores result in the object.

The second operator with a complex type, multiplies the complex value of the right hand side to the object and stores the result in the object.

The this pointer is returned.

operator/=

Divides by and assigns to a complex class.

  complex<T>& operator/=(const T&);
  template<class X> complex<T>& operator/=
  (const complex<X>&);
  
Remarks

The first operator with a scalar argument divides the scalar value of the right hand side to class object and stores result in the object.

The second operator with a complex type, divides the complex value of the right hand side into the object and stores the result in the object.

The this pointer is returned.