complex<long double>
存储描述了排序的对象对两种类型 long double,则第一个表示第二部分表示复数实部和虚部的对象。
template<>
class complex<long double> {
public:
complex(
long double _RealVal = 0,
long double _ImagVal = 0
);
complex(
const complex<long double>& _ComplexNum
);
// rest same as template class complex
};
参数
_RealVal
复数的重载构造值的 long double 类型。_ImagVal
复数加法的值的小数类型 long double 构造。_ComplexNum
double 类型复数物理和虚部用于初始化类型 long double 构造的复数或 浮动 类型。
返回值
复数类型 long double。
备注
模板类的显式专用化复杂到类型 long double 复杂的类与它定义的模板仅类不同于构造函数。 从 long double 的转换。浮动 允许是隐式的,但是,要求 long double 到从 double 中转换为 explicit。 使用分配语法,使用 explicit 排除与类型转换的启动。
有关类模板 complex的更多信息,请参见 complex 类。 有关 complex类模板的成员列表,请参见 复杂成员。
示例
// complex_comp_ld.cpp
// compile with: /EHsc
#include <complex>
#include <iostream>
int main( )
{
using namespace std;
double pi = 3.14159265359;
// The first constructor specifies real & imaginary parts
complex <long double> c1 ( 4.0 , 5.0 );
cout << "Specifying initial real & imaginary parts,\n"
<< " as type float gives c1 = " << c1 << endl;
// The second constructor initializes values of the real &
// imaginary parts using those of complex number of type float
complex <float> c2float ( 1.0 , 3.0 );
complex <long double> c2longdouble ( c2float );
cout << "Implicit conversion from type float to type long double,"
<< "\n gives c2longdouble = " << c2longdouble << endl;
// The third constructor initializes values of the real &
// imaginary parts using those of a complex number
// of type double
complex <double> c3double ( 3.0 , 4.0 );
complex <long double> c3longdouble ( c3double );
cout << "Implicit conversion from type long double to type float,"
<< "\n gives c3longdouble = " << c3longdouble << endl;
// The modulus and argument of a complex number can be recovered
double absc3 = abs ( c3longdouble );
double argc3 = arg ( c3longdouble );
cout << "The modulus of c3 is recovered from c3 using: abs ( c3 ) = "
<< absc3 << endl;
cout << "Argument of c3 is recovered from c3 using:\n arg ( c3 ) = "
<< argc3 << " radians, which is " << argc3 * 180 / pi
<< " degrees." << endl;
}
要求
标题: <复杂>
命名空间: std