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
    类型 长的二进制文件 的值构造的复数的实部的。

  • _ImagVal
    类型 long double 的值构造的复数的虚拟部分。

  • _ComplexNum
    类型 二进制文件 的复数物理和虚拟部分用于初始化类型构造的 long double 的一个复数的或的类型 float

返回值

类型 long double的一个复数。

备注

模板类复杂的显式专用化到类型 long double 复杂类的与它所定义的模板仅类不同于构造函数。从 long double 的转换到 float 允许是隐式的,但是,到 long double 需要从 二进制文件 的转换非常 显式。使用分配语法,使用 显式 排除进行类型转换时的激活。

有关模板类 complex的更多信息,请参见 complex Class。有关模板类 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;
}
  

要求

标题: complex

命名空间: std

请参见

参考

complex Class

线程安全性对标准C++库中

其他资源

complex 成员

复杂成员