table of contents
        
      
      
    - Tumbleweed 2024.07.05-1.3
 - Leap-16.0
 - Leap-15.6
 
| std::complex::real(3) | C++ Standard Libary | std::complex::real(3) | 
NAME¶
std::complex::real - std::complex::real
Synopsis¶
 primary template
  
   std::complex<T>
  
   T real() const; (until
  
   C++14)
  
   constexpr T real() (since
  
   const; C++14)
  
   void real( T value (until
  
   ); C++20)
  
   constexpr void real( (since
  
   T value ); C++20)
  
   specialization
  
   std::complex<float>
  
   float real() const; (until
  
   C++11)
  
   constexpr float (since
  
   real() const; C++11)
  
   void real( float (until
  
   value ); C++20)
  
   constexpr void real( (since
  
   float value ); C++20)
  
   specialization
  
   std::complex<double> (1)
  
   double real() const; (until
  
   (2) C++11)
  
   constexpr double (since
  
   real() const; C++11)
  
   void real( double (1) (until
  
   value ); C++20)
  
   constexpr void real( (2) (since
  
   double value ); C++20)
  
   specialization
  
   std::complex<long (1)
  
   double>
  
   long double real() (2) (until
  
   const; C++11)
  
   constexpr long (since
  
   double real() const; (1) C++11)
  
   void real( long (until
  
   double value ); (2) C++20)
  
   constexpr void real( (since
  
   long double value ); C++20)
  
   Accesses the real part of the complex number.
  
   1) Returns the real part.
  
   2) Sets the real part to value.
Parameters¶
value - the value to set the real part to
Return value¶
 1) The real part of *this.
  
   2) (none)
Notes¶
 In C++11, overload (1) in std::complex specializations
    used to be specified without
  
   const qualifier. However, in C++11, a constexpr specifier used in a
    non-static
  
   member function implies const, and thus the behavior is as if const is
    specified.
  
   Defect reports
  
   The following behavior-changing defect reports were applied retroactively to
  
   previously published C++ standards.
  
   DR Applied to Behavior as published Correct behavior
  
   LWG 387 C++98 the real part could not be set can be set directly via a new
    real
  
   directly overload
See also¶
 real returns the real part
  
   (function template)
  
   imag accesses the imaginary part of the complex number
  
   (public member function)
| 2024.06.10 | http://cppreference.com |