Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::complex<T>::imag

      From cppreference.com
      <cpp‎ |numeric‎ |complex
       
       
       
       
      primary templatestd::complex<T>
      (1)
      T imag()const;
      (until C++14)
      constexpr T imag()const;
      (since C++14)
      (2)
      void imag( T value);
      (until C++20)
      constexprvoid imag( T value);
      (since C++20)
      specializationstd::complex<float>
      (1)
      float imag()const;
      (until C++11)
      constexprfloat imag()const;
      (since C++11)
      (2)
      void imag(float value);
      (until C++20)
      constexprvoid imag(float value);
      (since C++20)
      specializationstd::complex<double>
      (1)
      double imag()const;
      (until C++11)
      constexprdouble imag()const;
      (since C++11)
      (2)
      void imag(double value);
      (until C++20)
      constexprvoid imag(double value);
      (since C++20)
      specializationstd::complex<longdouble>
      (1)
      longdouble imag()const;
      (until C++11)
      constexprlongdouble imag()const;
      (since C++11)
      (2)
      void imag(longdouble value);
      (until C++20)
      constexprvoid imag(longdouble value);
      (since C++20)

      Accesses the imaginary part of the complex number.

      1) Returns the imaginary part.
      2) Sets the imaginary part tovalue.

      Contents

      [edit]Parameters

      value - the value to set the imaginary part to

      [edit]Return value

      1) The imaginary part of*this.
      2) (none)

      [edit]Notes

      In C++11, overload(1) instd::complex specializations used to be specified withoutconst qualifier. However, in C++11, aconstexpr specifier used in a non-static member function impliesconst, and thus the behavior is as ifconst is specified.

      [edit]Defect reports

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

      DRApplied toBehavior as publishedCorrect behavior
      LWG 387C++98the imaginary part could not be set directlycan be set directly via a newimag overload

      [edit]See also

      returns the imaginary part
      (function template)[edit]
      accesses the real part of the complex number
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/numeric/complex/imag&oldid=147509"

      [8]ページ先頭

      ©2009-2025 Movatter.jp