real

constexpr double real(const Complex &z) noexcept

Gets the real component x.

Parameters

const Complex &z

A complex number.

Returns

double

A real number.

Gets the real component of a complex object.

Example

Complex z(1, 4);
std::cout << real(z) << "\n";

Output:

1