Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::complex<T>::operator=

      From cppreference.com
      <cpp‎ |numeric‎ |complex
       
       
       
       
      All specializations
      (1)
      complex& operator=(const complex& cx);
      (until C++20)
      constexpr complex& operator=(const complex& cx);
      (since C++20)
      (2)
      template<class X>
      complex& operator=(conststd::complex<X>& cx);
      (until C++20)
      template<class X>
      constexpr complex& operator=(conststd::complex<X>& cx);
      (since C++20)
      Primary templatecomplex<T>
      (3)
      complex& operator=(const T& x);
      (until C++20)
      constexpr complex& operator=(const T& x);
      (since C++20)
      Specializations for standard floating-point typescomplex<F>(until C++23)
      (3)
      complex& operator=( F x);
      (until C++20)
      constexpr complex& operator=( F x);
      (since C++20)
      (until C++23)

      Assigns new values to the contents.

      1,2) Assignscx.real() andcx.imag() to the real and the imaginary parts of the complex number respectively.The copy assignment operator(1) istrivial whenT is a floating-point type.(since C++23)
      3) Assignsx to the real part of the complex number. Imaginary part is set to zero.

      Contents

      [edit]Parameters

      x - value to assign
      cx - complex value to assign

      [edit]Return value

      *this

      [edit]Notes

      The copy assignment operator is required to betrivial since C++23, but implementations generally make it trivial in all modes.

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 3935C++98the description of overload(2) was missingadded

      [edit]See also

      constructs a complex number
      (public member function)[edit]
      astd::complex literal representing purely imaginary number
      (function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/numeric/complex/operator%3D&oldid=162277"

      [8]ページ先頭

      ©2009-2025 Movatter.jp