⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 std_complex.h

📁 linux下编程用 编译软件
💻 H
📖 第 1 页 / 共 3 页
字号:
				      __y.imag() * log(__x))	                 : std::pow(complex<_Tp>(__x, _Tp()), __y);    }  // 26.2.3  complex specializations  // complex<float> specialization  template<>    struct complex<float>    {      typedef float value_type;      typedef __complex__ float _ComplexT;      complex(_ComplexT __z) : _M_value(__z) { }      complex(float = 0.0f, float = 0.0f);      explicit complex(const complex<double>&);      explicit complex(const complex<long double>&);      float& real();      const float& real() const;      float& imag();      const float& imag() const;      complex<float>& operator=(float);      complex<float>& operator+=(float);      complex<float>& operator-=(float);      complex<float>& operator*=(float);      complex<float>& operator/=(float);      // Let's the compiler synthetize the copy and assignment      // operator.  It always does a pretty good job.      // complex& operator= (const complex&);      template<typename _Tp>        complex<float>&operator=(const complex<_Tp>&);      template<typename _Tp>        complex<float>& operator+=(const complex<_Tp>&);      template<class _Tp>        complex<float>& operator-=(const complex<_Tp>&);      template<class _Tp>        complex<float>& operator*=(const complex<_Tp>&);      template<class _Tp>        complex<float>&operator/=(const complex<_Tp>&);      const _ComplexT& __rep() const { return _M_value; }    private:      _ComplexT _M_value;    };  inline float&  complex<float>::real()  { return __real__ _M_value; }  inline const float&  complex<float>::real() const  { return __real__ _M_value; }  inline float&  complex<float>::imag()  { return __imag__ _M_value; }  inline const float&  complex<float>::imag() const  { return __imag__ _M_value; }  inline  complex<float>::complex(float r, float i)  {    __real__ _M_value = r;    __imag__ _M_value = i;  }  inline complex<float>&  complex<float>::operator=(float __f)  {    __real__ _M_value = __f;    __imag__ _M_value = 0.0f;    return *this;  }  inline complex<float>&  complex<float>::operator+=(float __f)  {    __real__ _M_value += __f;    return *this;  }  inline complex<float>&  complex<float>::operator-=(float __f)  {    __real__ _M_value -= __f;    return *this;  }  inline complex<float>&  complex<float>::operator*=(float __f)  {    _M_value *= __f;    return *this;  }  inline complex<float>&  complex<float>::operator/=(float __f)  {    _M_value /= __f;    return *this;  }  template<typename _Tp>  inline complex<float>&  complex<float>::operator=(const complex<_Tp>& __z)  {    __real__ _M_value = __z.real();    __imag__ _M_value = __z.imag();    return *this;  }  template<typename _Tp>  inline complex<float>&  complex<float>::operator+=(const complex<_Tp>& __z)  {    __real__ _M_value += __z.real();    __imag__ _M_value += __z.imag();    return *this;  }      template<typename _Tp>    inline complex<float>&    complex<float>::operator-=(const complex<_Tp>& __z)    {     __real__ _M_value -= __z.real();     __imag__ _M_value -= __z.imag();     return *this;    }   template<typename _Tp>    inline complex<float>&    complex<float>::operator*=(const complex<_Tp>& __z)    {      _ComplexT __t;      __real__ __t = __z.real();      __imag__ __t = __z.imag();      _M_value *= __t;      return *this;    }  template<typename _Tp>    inline complex<float>&    complex<float>::operator/=(const complex<_Tp>& __z)    {      _ComplexT __t;      __real__ __t = __z.real();      __imag__ __t = __z.imag();      _M_value /= __t;      return *this;    }  // 26.2.3  complex specializations  // complex<double> specialization  template<>    struct complex<double>    {      typedef double value_type;      typedef __complex__ double _ComplexT;      complex(_ComplexT __z) : _M_value(__z) { }      complex(double = 0.0, double = 0.0);      complex(const complex<float>&);      explicit complex(const complex<long double>&);      double& real();      const double& real() const;      double& imag();      const double& imag() const;      complex<double>& operator=(double);      complex<double>& operator+=(double);      complex<double>& operator-=(double);      complex<double>& operator*=(double);      complex<double>& operator/=(double);      // The compiler will synthetize this, efficiently.      // complex& operator= (const complex&);      template<typename _Tp>        complex<double>& operator=(const complex<_Tp>&);      template<typename _Tp>        complex<double>& operator+=(const complex<_Tp>&);      template<typename _Tp>        complex<double>& operator-=(const complex<_Tp>&);      template<typename _Tp>        complex<double>& operator*=(const complex<_Tp>&);      template<typename _Tp>        complex<double>& operator/=(const complex<_Tp>&);      const _ComplexT& __rep() const { return _M_value; }    private:      _ComplexT _M_value;    };  inline double&  complex<double>::real()  { return __real__ _M_value; }  inline const double&  complex<double>::real() const  { return __real__ _M_value; }  inline double&  complex<double>::imag()  { return __imag__ _M_value; }  inline const double&  complex<double>::imag() const  { return __imag__ _M_value; }  inline  complex<double>::complex(double __r, double __i)  {    __real__ _M_value = __r;    __imag__ _M_value = __i;  }  inline complex<double>&  complex<double>::operator=(double __d)  {    __real__ _M_value = __d;    __imag__ _M_value = 0.0;    return *this;  }  inline complex<double>&  complex<double>::operator+=(double __d)  {    __real__ _M_value += __d;    return *this;  }  inline complex<double>&  complex<double>::operator-=(double __d)  {    __real__ _M_value -= __d;    return *this;  }  inline complex<double>&  complex<double>::operator*=(double __d)  {    _M_value *= __d;    return *this;  }  inline complex<double>&  complex<double>::operator/=(double __d)  {    _M_value /= __d;    return *this;  }  template<typename _Tp>    inline complex<double>&    complex<double>::operator=(const complex<_Tp>& __z)    {      __real__ _M_value = __z.real();      __imag__ _M_value = __z.imag();      return *this;    }      template<typename _Tp>    inline complex<double>&    complex<double>::operator+=(const complex<_Tp>& __z)    {      __real__ _M_value += __z.real();      __imag__ _M_value += __z.imag();      return *this;    }  template<typename _Tp>    inline complex<double>&    complex<double>::operator-=(const complex<_Tp>& __z)    {      __real__ _M_value -= __z.real();      __imag__ _M_value -= __z.imag();      return *this;    }  template<typename _Tp>    inline complex<double>&    complex<double>::operator*=(const complex<_Tp>& __z)    {      _ComplexT __t;      __real__ __t = __z.real();      __imag__ __t = __z.imag();      _M_value *= __t;      return *this;    }  template<typename _Tp>    inline complex<double>&    complex<double>::operator/=(const complex<_Tp>& __z)    {      _ComplexT __t;      __real__ __t = __z.real();      __imag__ __t = __z.imag();      _M_value /= __t;      return *this;    }  // 26.2.3  complex specializations  // complex<long double> specialization  template<>    struct complex<long double>    {      typedef long double value_type;      typedef __complex__ long double _ComplexT;      complex(_ComplexT __z) : _M_value(__z) { }      complex(long double = 0.0L, long double = 0.0L);      complex(const complex<float>&);      complex(const complex<double>&);      long double& real();      const long double& real() const;      long double& imag();      const long double& imag() const;      complex<long double>& operator= (long double);      complex<long double>& operator+= (long double);      complex<long double>& operator-= (long double);      complex<long double>& operator*= (long double);      complex<long double>& operator/= (long double);      // The compiler knows how to do this efficiently      // complex& operator= (const complex&);      template<typename _Tp>        complex<long double>& operator=(const complex<_Tp>&);      template<typename _Tp>        complex<long double>& operator+=(const complex<_Tp>&);      template<typename _Tp>        complex<long double>& operator-=(const complex<_Tp>&);      template<typename _Tp>        complex<long double>& operator*=(const complex<_Tp>&);      template<typename _Tp>        complex<long double>& operator/=(const complex<_Tp>&);      const _ComplexT& __rep() const { return _M_value; }    private:      _ComplexT _M_value;    };  inline  complex<long double>::complex(long double __r, long double __i)  {    __real__ _M_value = __r;    __imag__ _M_value = __i;  }  inline long double&  complex<long double>::real()  { return __real__ _M_value; }  inline const long double&  complex<long double>::real() const  { return __real__ _M_value; }  inline long double&  complex<long double>::imag()  { return __imag__ _M_value; }  inline const long double&  complex<long double>::imag() const  { return __imag__ _M_value; }  inline complex<long double>&     complex<long double>::operator=(long double __r)  {    __real__ _M_value = __r;    __imag__ _M_value = 0.0L;    return *this;  }  inline complex<long double>&  complex<long double>::operator+=(long double __r)  {    __real__ _M_value += __r;    return *this;  }  inline complex<long double>&  complex<long double>::operator-=(long double __r)  {    __real__ _M_value -= __r;    return *this;  }  inline complex<long double>&  complex<long double>::operator*=(long double __r)  {    _M_value *= __r;    return *this;  }  inline complex<long double>&  complex<long double>::operator/=(long double __r)  {    _M_value /= __r;    return *this;  }  template<typename _Tp>    inline complex<long double>&    complex<long double>::operator=(const complex<_Tp>& __z)    {      __real__ _M_value = __z.real();      __imag__ _M_value = __z.imag();      return *this;    }  template<typename _Tp>    inline complex<long double>&    complex<long double>::operator+=(const complex<_Tp>& __z)    {      __real__ _M_value += __z.real();      __imag__ _M_value += __z.imag();      return *this;    }  template<typename _Tp>    inline complex<long double>&    complex<long double>::operator-=(const complex<_Tp>& __z)    {      __real__ _M_value -= __z.real();      __imag__ _M_value -= __z.imag();      return *this;    }      template<typename _Tp>    inline complex<long double>&    complex<long double>::operator*=(const complex<_Tp>& __z)    {      _ComplexT __t;      __real__ __t = __z.real();      __imag__ __t = __z.imag();      _M_value *= __t;      return *this;    }  template<typename _Tp>    inline complex<long double>&    complex<long double>::operator/=(const complex<_Tp>& __z)    {      _ComplexT __t;      __real__ __t = __z.real();      __imag__ __t = __z.imag();      _M_value /= __t;      return *this;    }  // These bits have to be at the end of this file, so that the  // specializations have all been defined.  // ??? No, they have to be there because of compiler limitation at  // inlining.  It suffices that class specializations be defined.  inline  complex<float>::complex(const complex<double>& __z)  : _M_value(__z.__rep()) { }  inline  complex<float>::complex(const complex<long double>& __z)  : _M_value(__z.__rep()) { }  inline  complex<double>::complex(const complex<float>& __z)   : _M_value(__z.__rep()) { }  inline  complex<double>::complex(const complex<long double>& __z)    : _M_value(__z.__rep()) { }  inline  complex<long double>::complex(const complex<float>& __z)  : _M_value(__z.__rep()) { }  inline  complex<long double>::complex(const complex<double>& __z)  : _M_value(__z.__rep()) { }} // namespace std#endif	/* _GLIBCXX_COMPLEX */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -