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) Numeric algorithms gcd(C++17) lcm(C++17) 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)

 template< class T > complex operator+( const complex& lhs, const complex& rhs); (1) template< class T > complex operator+( const complex& lhs, const T& rhs); (2) template< class T > complex operator+( const T& lhs, const complex& rhs); (3) template< class T > complex operator-( const complex& lhs, const complex& rhs); (4) template< class T > complex operator-( const complex& lhs, const T& rhs); (5) template< class T > complex operator-( const T& lhs, const complex& rhs); (6) template< class T > complex operator*( const complex& lhs, const complex& rhs); (7) template< class T > complex operator*( const complex& lhs, const T& rhs); (8) template< class T > complex operator*( const T& lhs, const complex& rhs); (9) template< class T > complex operator/( const complex& lhs, const complex& rhs); (10) template< class T > complex operator/( const complex& lhs, const T& rhs); (11) template< class T > complex operator/( const T& lhs, const complex& rhs); (12)

Implements the binary operators for complex arithmetic and for mixed complex/scalar arithmetic. Scalar arguments are treated as complex numbers with the real part equal to the argument and the imaginary part set to zero.

1-3) Returns the sum of its arguments
4-6) Returns the result of subtracting rhs from lhs
7-9) Multiplies its arguments
10-12) Divides lhs by rhs

Parameters

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

Return value

1-3) complex<T>(lhs) += rhs
4-6) complex<T>(lhs) -= rhs
7-9) complex<T>(lhs) *= rhs
10-12) complex<T>(lhs) /= rhs