std::complex::operator+(unary), operator-(unary) - cppreference.com (original) (raw)

| (1) | | | | -------------------------------------------------------------------------------------------------------------------------------- | | ------------- | | template< class T > std::complex<T> operator+( const std::complex<T>& val ); | | (until C++20) | | template< class T > constexpr std::complex<T> operator+( const std::complex<T>& val ); | | (since C++20) | | (2) | | | | template< class T > std::complex<T> operator-( const std::complex<T>& val ); | | (until C++20) | | template< class T > constexpr std::complex<T> operator-( const std::complex<T>& val ); | | (since C++20) |

Implements the analogs of the unary arithmetic operators for complex numbers.

  1. Returns the value of its argument

  2. Negates the argument

[edit] Parameters

val - the complex number argument

[edit] Return value

  1. negated argument, std::complex<T>(-val.real(), -val.imag())

[edit] See also