Scroll to navigation

std::complex::real(3) C++ Standard Libary std::complex::real(3)

NAME

std::complex::real - std::complex::real

Synopsis


primary template
complex<T>
T real() const; (until
C++14)
constexpr T (since
real() const; C++14)
void real( T (until
value ); C++20)
constexpr void (since
real( T value ); C++20)
specialization
complex<float>
float real() (until
const; C++11)
constexpr float (since
real() const; C++11)
void real( float (until
value ); C++20)
constexpr void (since
real( float C++20)
value );
specialization
complex<double>
double real() (1) (until
const; C++11)
constexpr double (2) (since
real() const; C++11)
void real( (until
double value ); (1) C++20)
constexpr void (since
real( double (2) C++20)
value );
specialization
complex<long (1)
double>
long double (2) (until
real() const; C++11)
constexpr long (since
double real() C++11)
const; (1)
void real( long (until
double value ); C++20)
constexpr void (2) (since
real( long C++20)
double value );


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.
2) (none)

Notes


In C++11, overload (1) in 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.

See also


real returns the real component
(function template)
imag accesses the imaginary part of the complex number
(public member function)

2022.07.31 http://cppreference.com