The overloaded complex operators consists of:
Adds to the complex class.
template<class T> complex<T> operator+ const complex<T>&, const complex<T>&); template<class T> complex<T> operator+ (const complex<T>&, const T&); template<class T> complex<T> operator+ (const T&, const complex<T>&); template<class T> complex<T> operator+ (const complex<T>&);
The addition performs a += operation.
Returns the complex class after the addition.
Subtracts from the complex class.
template<class T> complex<T> operator- (const complex<T>&, const complex<T>&); template<class T> complex<T> operator- (const complex<T>&, const T&); template<class T> complex<T> operator- (const T&, const complex<T>&); template<class T> complex<T> operator- (const complex<T>&);
The subtraction performs a -= operation.
Returns the complex class after the Subtraction.
Multiplies the complex class.
template<class T> complex<T> operator* (const complex<T>&, const complex<T>&); template<class T> complex<T> operator* (const complex<T>&, const T&); template<class T> complex<T> operator* (const T&, const complex<T>&);
The multiplication performs a *= operation.
Returns the complex class after the multiplication.
Divides from the complex class.
template<class T> complex<T> operator/ (const complex<T>&, const complex<T>&); template<class T> complex<T> operator/ (const complex<T>&, const T&); template<class T> complex<T> operator/ (const T&, const complex<T>&);
The division performs a /= operation.
Returns the complex class after the division.
A boolean equality comparison.
template<class T> bool operator== (const complex<T>&, const complex<T>&); template<class T> bool operator== (const complex<T>&, const T&); template<class T> bool operator== (const T&, const complex<T>&);
Returns true if the real and imaginary components are equal.
A boolean non equality comparison.
template<class T> bool operator!= (const complex<T>&, const complex<T>&); template<class T> bool operator!= (const complex<T>&, const T&); template<class T> bool operator!= (const T&, const complex<T>&);
Returns true if the real or the imaginary components are not equal.
Extracts a complex type from a stream.
template<class T, class charT, class traits> basic_istream<charT, traits>& operator>> (basic_istream<charT, traits>&, complex<T>&);
Extracts in the form of u, (u), or (u,v) where u is the real part and v is the imaginary part.
Any failure in extraction will set the failbit and result in undefined behavior.
Inserts a complex number into a stream.
template<class T, class charT, class traits> basic_ostream<charT, traits>& operator<< (basic_ostream<charT, traits>&,const complex<T>&);