On this page
std::complex<T>::real
|
||
(1) | ||
|
(until C++14) | |
|
(since C++14) | |
(2) | ||
|
(until C++20) | |
|
(since C++20) | |
|
||
(1) | ||
|
(until C++11) | |
|
(since C++11) | |
(2) | ||
|
(until C++20) | |
|
(since C++20) | |
|
||
(1) | ||
|
(until C++11) | |
|
(since C++11) | |
(2) | ||
|
(until C++20) | |
|
(since C++20) | |
|
||
(1) | ||
|
(until C++11) | |
|
(since C++11) | |
(2) | ||
|
(until C++20) | |
|
(since 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 directly | can be set directly via a new real overload |
See also
returns the real part (function template) |
|
accesses the imaginary part of the complex number (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/numeric/complex/real