SysTutorials

Linux Manual Pages › Section 3

stdcomplexoperator(3)

std::complex<T>::operator= - std::complex<T>::operator=

Synopsis

primary template complex<T>
    complex &operator=(const T &x);
(until C++ 20)
    constexpr complex &
    operator=(const T &x);
(since C++ 20)
    specialization complex<float>
    complex &operator=(float x);
(until C++ 20)
    constexpr complex &
    operator=(float x);
(since C++ 20)
    specialization complex<double>
    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);
(1)(since C++ 20)
    all specializations(1)
        complex &
        operator=(const complex &cx);
(until C++ 20)
    constexpr complex &
    operator=(const complex &cx);
(1)(since C++ 20)
    template <class X>
    (2)(until C++ 20)
        complex &
        operator=(const std::complex<X> &cx);
(3)
    template <class X>
    (since C++ 20)
        constexpr complex &
        operator=(const std::complex<X> &cx);

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.

Parameters

x - value to assign cx - complex value to assign

Return value

*this

See also

              constructs a complex number constructor (public member function) operator""if operator""i A std::complex literal representing pure imaginary number operator""il (function) (C++14)