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

< cpp‎ | numeric‎ | complex

C++
 Language Standard library headers Concepts Utilities library Strings library Containers library Algorithms library Iterators library Numerics library Input/output library Localizations library Regular expressions library (C++11) Atomic operations library (C++11) Thread support library (C++11) Filesystem library (C++17) Technical Specifications

Numerics library
 Common mathematical functions Special mathematical functions Floating-point environment (C++11) Complex numbers Numeric arrays Pseudo-random number generation Compile-time rational arithmetic (C++11) Generic numeric operations iota(C++11) accumulate inner_product adjacent_difference partial_sum

std::complex
Member functions
Non-member functions
 operator+operator- operator+operator-operator*operator/ operator==operator!= operator<>
 real imag abs arg norm conj proj(C++11) polar operator""ioperator""ifoperator""il(C++14)(C++14)(C++14)
Exponential functions
Power functions
Trigonometric functions
 asin(C++11) acos(C++11) atan(C++11)
Hyperbolic functions
 asinh(C++11) acosh(C++11) atanh(C++11)

 Defined in header `` template< class T > constexpr bool operator==( const complex& lhs, const complex& rhs); (1) template< class T > constexpr bool operator==( const complex& lhs, const T& rhs); (2) template< class T > constexpr bool operator==( const T& lhs, const complex& rhs); (3) template< class T > constexpr bool operator!=( const complex& lhs, const complex& rhs); (4) template< class T > constexpr bool operator!=( const complex& lhs, const T& rhs); (5) template< class T > constexpr bool operator!=( const T& lhs, const complex& rhs); (6)

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.

### Parameters

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

### Return value

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

### Notes

Overloads are marked as constexpr since c++14