std::real(std::complex)_C++中文网

定义于头文件 <complex>

(1)

template< class T >
T real( const std::complex<T>& z );

(C++14 前)

template< class T >
constexpr T real( const std::complex<T>& z );

(C++14 起)
(2)

float real( float z );

template< class DoubleOrInteger >
double real( DoubleOrInteger z );

long double real( long double z );

(C++11 起)
(C++14 前)

constexpr float real( float z );

template< class DoubleOrInteger >
constexpr double real( DoubleOrInteger z );

constexpr long double real( long double z );

(C++14 起)

1) 返回复数 z 的实部,即 z.real()

2)floatdoublelong double 和所有整数类型提供额外重载,它们被处理为拥有零虚部的复数。

(C++11 起)

参数

返回值

z 的实部

参阅