Scroll to navigation

std::complex::operator+(unary),operator-(unary)(3) C++ Standard Libary std::complex::operator+(unary),operator-(unary)(3)

NAME

std::complex::operator+(unary),operator-(unary) - std::complex::operator+(unary),operator-(unary)

Synopsis


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


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


1) Returns the value of its argument
2) Negates the argument

Parameters


val - the complex number argument

Return value


1) a copy of the argument, std::complex<T>(val)
2) negated argument, std::complex<T>(-val.real(), -val.imag())

See also


operator+ performs complex number arithmetics on two complex values or a complex and
operator- a scalar
operator* (function template)
operator/

2022.07.31 http://cppreference.com