std::real(std::complex)(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– 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 value
  • f β€” floating-point value
  • i β€” integer value

πŸŽ€ Return value πŸŽ€

  • 1) The real part of z.
  • 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 num has a standard (until C++23) floating-point type T, then std::real(num) has the same effect as std::real(std::complex<T>(num)).
  • Otherwise, if num has an integer type, then std::real(num) has the same effect as std::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