std::conj(std::complex)(3)

NAME
std::conj(std::complex) - std::conj(std::complex)

Synopsis
   Defined in header <complex>
   template< class T >
   std::complex<T> conj( const std::complex<T>& z (until C++20)
   );
   template< class T >
   constexpr std::complex<T> conj( const (since C++20)
   std::complex<T>& z );
   std::complex<float> conj( float z );
   template< class DoubleOrInteger > (since C++11)
   std::complex<double> conj( DoubleOrInteger z ); (1) (until C++20)
   std::complex<long double> conj( long double z );
   constexpr std::complex<float> conj( float z ); (2)
   template< class DoubleOrInteger >
   constexpr std::complex<double> conj( (since C++20)
   DoubleOrInteger z );
   constexpr std::complex<long double> conj( long
   double z );
   1) Computes the complex conjugate of z by reversing the sign of the imaginary part.
   2) Additional overloads are provided for float, double, long double,
   and all integer types, which are treated as complex numbers with zero (since C++11)
   imaginary component.

Parameters
   z - complex value

Return value
   The complex conjugate of z

Example
// Run this code
 #include <iostream>
 #include <complex>
 int main()
 {
     std::complex<double> z(1,2);
     std::cout << "The conjugate of " << z << " is " << std::conj(z) << '\n'
               << "Their product is " << z*std::conj(z) << '\n';
 }

Output:
 The conjugate of (1,2) is (1,-2)
 Their product is (5,0)

See also
   abs(std::complex) returns the magnitude of a complex number
                     (function template)
   norm returns the squared magnitude
                     (function template)
   polar constructs a complex number from magnitude and phase angle
                     (function template)