Namespaces
Variants
Views
Actions

std::complex::operator=

From cppreference.com
< cpp‎ | numeric‎ | complex
primary template complex<T>
(1)
complex& operator=(const T& x);
(until C++20)
constexpr complex& operator=(const T& x);
(since C++20)
specialization complex<float>
(1)
complex& operator=(float x);
(until C++20)
constexpr complex& operator=(float x);
(since C++20)
specialization complex<double>
(1)
complex& operator=(double x);
(until C++20)
constexpr complex& operator=(double x);
(since C++20)
specialization complex<long double>
(1)
complex& operator=(long double x);
(until C++20)
constexpr complex& operator=(long double x);
(since C++20)
all specializations
(2)
complex& operator=(const complex& cx);
(until C++20)
constexpr complex& operator=(const complex& cx);
(since C++20)
(3)
template<class X>
complex& operator=(const std::complex<X>& cx);
(until C++20)
template<class X>
constexpr complex& operator=(const std::complex<X>& cx);
(since C++20)

Assigns new values to the contents.

1) Assigns x to the real part of the complex number. Imaginary part is set to zero.
2,3) Assigns cx.real() and cx.imag() to the real and the imaginary parts of the complex number respectively.

[edit] Parameters

x - value to assign
cx - complex value to assign

[edit] Return value

*this

[edit] See also

constructs a complex number
(public member function) [edit]
A std::complex literal representing pure imaginary number
(function) [edit]