Namespaces
Variants
Views
Actions

operator==,!=(std::complex)

From cppreference.com
< cpp‎ | numeric‎ | complex
 
 
 
std::complex
Member functions
Non-member functions
Exponential functions
Power functions
Trigonometric functions
(C++11)
(C++11)
(C++11)
Hyperbolic functions
(C++11)
(C++11)
(C++11)
 
Defined in header <complex>
(1)
template< class T >
bool operator==( const complex<T>& lhs, const complex<T>& rhs);
(until C++14)
template< class T >
constexpr bool operator==( const complex<T>& lhs, const complex<T>& rhs);
(since C++14)
(2)
template< class T >
bool operator==( const complex<T>& lhs, const T& rhs);
(until C++14)
template< class T >
constexpr bool operator==( const complex<T>& lhs, const T& rhs);
(since C++14)
(3)
template< class T >
bool operator==( const T& lhs, const complex<T>& rhs);
(until C++14)
template< class T >
constexpr bool operator==( const T& lhs, const complex<T>& rhs);
(since C++14)
(until C++20)
(4)
template< class T >
bool operator!=( const complex<T>& lhs, const complex<T>& rhs);
(until C++14)
template< class T >
constexpr bool operator!=( const complex<T>& lhs, const complex<T>& rhs);
(since C++14)
(until C++20)
(5)
template< class T >
bool operator!=( const complex<T>& lhs, const T& rhs);
(until C++14)
template< class T >
constexpr bool operator!=( const complex<T>& lhs, const T& rhs);
(since C++14)
(until C++20)
(6)
template< class T >
bool operator!=( const T& lhs, const complex<T>& rhs);
(until C++14)
template< class T >
constexpr bool operator!=( const T& lhs, const complex<T>& rhs);
(since C++14)
(until C++20)

Compares two complex numbers. Scalar arguments are treated as complex numbers with the real part equal to the argument and the imaginary part set to zero.

1-3) Compares lhs and rhs for equality.
4-6) Compares lhs and rhs for inequality.

[edit] Parameters

lhs, rhs - the arguments to compare: either both complex numbers or one complex and one scalar of matching type (float, double, long double)

[edit] Return value

1-3) true if respective parts of lhs are equal to rhs, false otherwise.
4-6) !(lhs == rhs)

[edit] Example