std::real(std::complex)(3)
π NAME π
okay bestie, this is the manual page for std::real(std::complex)(3) from the C++ Standard Libary β yes, that manual name is staying exactly like that, typo and all π
β¨
std::real(std::complex) β literally std::real(std::complex), no notes, we move.
β¨ Synopsis β¨
okay so here's the whole overload saga, bestie β don't let the line wraps scare you, every single (until C++14), (since C++14), (since C++11), (1), (A), (B), (until C++23), and (since C++23) is staying π«Ά
Defined in header <complex>
template< class T >
T real( const std::complex<T>& z (until C++14)
);
template< class T >
constexpr T real( const (since C++14)
std::complex<T>& z );
Additional overloads (since C++11)
Defined in header <complex>
float real( float f );
double real( double f ); (until
C++14)
long double real( long double f );
constexpr float real( float
f ); (1)
constexpr double real( double (since
C++14)
f ); (until
C++23)
(A)
constexpr long double real( long
double f );
template< class FloatingPoint >
constexpr FloatingPoint real( (since
C++23)
FloatingPoint f );
template< class Integer >
(until C++14)
double real( Integer i );
template< class Integer > (B)
constexpr double real( Integer i
(since C++14)
);
so like, 1) gives you the real part of the complex number z, which is literally z.real(). slay.
and A,B)? those extra overloads are provided for all integer and floating-point types, and they're treated as complex numbers with zero imaginary part (since C++11). iconic behavior fr fr π
πΈ Parameters πΈ
zβ complex valuefβ floating-point valueiβ integer value
π Return value π
1)The real part ofz.A)f.B)static_cast<double>(i).
π¦ Notes π¦
the additional overloads are not required to be provided exactly as (A,B). they only need to be sufficient to ensure that for their argument num:
- If
numhas a standard(until C++23)floating-point typeT, thenstd::real(num)has the same effect asstd::real(std::complex<T>(num)). - Otherwise, if
numhas an integer type, thenstd::real(num)has the same effect asstd::real(std::complex<double>(num)).
no cap, that's the whole vibe check on the overload rules π§β¨
π See also π
realβ accesses the real part of the complex number (public member function)imagβ returns the imaginary part (function template)- C documentation for
creal
k bye bestie, this page comes from http://cppreference.com, dated 2024.06.10, and its manual title is std::real(std::complex)(3) π«Άπ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms