The Wayback Machine - https://web.archive.org/web/20220702213244/https://en.cppreference.com/w/cpp/numeric/complex/real
Namespaces
Variants
Views
Actions

std::complex<T>::real

From cppreference.com
< cpp‎ | numeric‎ | complex
 
 
 
std::complex
Member functions
complex::real
Non-member functions
Exponential functions
Power functions
Trigonometric functions
(C++11)
(C++11)
(C++11)
Hyperbolic functions
(C++11)
(C++11)
(C++11)
 
primary template complex<T>
(1)
T real() const;
(until C++14)
constexpr T real() const;
(since C++14)
(2)
void real( T value );
(until C++20)
constexpr void real( T value );
(since C++20)
specialization complex<float>
(1)
float real() const;
(until C++11)
constexpr float real() const;
(since C++11)
(2)
void real( float value );
(until C++20)
constexpr void real( float value );
(since C++20)
specialization complex<double>
(1)
double real() const;
(until C++11)
constexpr double real() const;
(since C++11)
(2)
void real( double value );
(until C++20)
constexpr void real( double value );
(since C++20)
specialization complex<long double>
(1)
long double real() const;
(until C++11)
constexpr long double real() const;
(since C++11)
(2)
void real( long double value );
(until C++20)
constexpr void real( long double value );
(since C++20)

Accesses the real part of the complex number.

1) Returns the real part.
2) Sets the real part to value.

Contents

[edit] Parameters

value - the value to set the real part to

[edit] Return value

1) The real part.
2) (none)

[edit] 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.

[edit] See also

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