# std::conj(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)

Numerics library
 Common mathematical functions Floating-point environment 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
 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 > complex conj( const complex& z ); (1) std::complex conj( long double z ); (2) (since C++11) template< class DoubleOrIngeter > std::complex conj( DoubleOrInteger z ); (3) (since C++11) std::complex conj( float z ); (4) (since C++11)

Computes the complex conjugate of `z` by reversing the sign of the imaginary part.

(since C++11)Additional overloads are provided for float, double, long double, and all integer types, which are treated as complex numbers with zero imaginary component.

## Contents

### Parameters

 z - complex value

### Return value

The complex conjugate of `z`

### Example

```#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)```