diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/stdapis/stlportv5/stl/_complex.h --- a/epoc32/include/stdapis/stlportv5/stl/_complex.h Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/stdapis/stlportv5/stl/_complex.h Wed Mar 31 12:33:34 2010 +0100 @@ -2,45 +2,46 @@ * Copyright (c) 1999 * Silicon Graphics Computer Systems, Inc. * - * Copyright (c) 1999 + * Copyright (c) 1999 * Boris Fomitchev * * This material is provided "as is", with absolutely no warranty expressed * or implied. Any use is at your own risk. * - * Permission to use or copy this software for any purpose is hereby granted + * Permission to use or copy this software for any purpose is hereby granted * without fee, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * - */ -#ifndef _STLP_internal_complex_h -#define _STLP_internal_complex_h + */ +#ifndef _STLP_INTERNAL_COMPLEX +#define _STLP_INTERNAL_COMPLEX -// This header declares the template class complex, as described in +// This header declares the template class complex, as described in // in the draft C++ standard. Single-precision complex numbers // are complex, double-precision are complex, and // quad precision are complex. // Note that the template class complex is declared within namespace -// std, as called for by the draft C++ standard. +// std, as called for by the draft C++ standard. -#include -#include +#ifndef _STLP_INTERNAL_CMATH +# include +#endif _STLP_BEGIN_NAMESPACE -#if !defined(_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround +#if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround template struct complex; -_STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex; -_STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex; -# ifndef _STLP_NO_LONG_DOUBLE -_STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex; -# endif -# endif +_STLP_TEMPLATE_NULL struct complex; +_STLP_TEMPLATE_NULL struct complex; +# if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_TEMPLATE_NULL struct complex; +# endif +#endif /* _STLP_NO_COMPLEX_SPECIALIZATIONS */ template struct complex { @@ -62,7 +63,7 @@ return *this; } -#if defined (_STLP_MEMBER_TEMPLATES) && ( defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined(_STLP_NO_COMPLEX_SPECIALIZATIONS)) +#if defined (_STLP_MEMBER_TEMPLATES) && (defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined(_STLP_NO_COMPLEX_SPECIALIZATIONS)) template explicit complex(const complex<_Tp2>& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {} @@ -108,14 +109,14 @@ // Arithmetic op= operations involving two complex arguments. static void _STLP_CALL _div(const value_type& __z1_r, const value_type& __z1_i, - const value_type& __z2_r, const value_type& __z2_i, - value_type& __res_r, value_type& __res_i); + const value_type& __z2_r, const value_type& __z2_i, + value_type& __res_r, value_type& __res_i); - static void _STLP_CALL _div(const value_type& __z1_r, - const value_type& __z2_r, const value_type& __z2_i, - value_type& __res_r, value_type& __res_i); + static void _STLP_CALL _div(const value_type& __z1_r, + const value_type& __z2_r, const value_type& __z2_i, + value_type& __res_r, value_type& __res_i); -#if defined ( _STLP_MEMBER_TEMPLATES ) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +#if defined (_STLP_MEMBER_TEMPLATES) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) template _Self& operator+= (const complex<_Tp2>& __z) { _M_re += __z._M_re; @@ -145,7 +146,6 @@ _M_im = __i; return *this; } - #endif /* _STLP_MEMBER_TEMPLATES */ _Self& operator+= (const _Self& __z) { @@ -159,7 +159,7 @@ _M_im -= __z._M_im; return *this; } - + _Self& operator*= (const _Self& __z) { value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; @@ -182,28 +182,27 @@ value_type _M_im; }; -#if !defined(_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround +#if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround // Explicit specializations for float, double, long double. The only // reason for these specializations is to enable automatic conversions // from complex to complex, and complex to // complex. - _STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex { typedef float value_type; typedef complex _Self; // Constructors, destructor, assignment operator. - complex(value_type __x = 0.0, value_type __y = 0.0) + complex(value_type __x = 0.0f, value_type __y = 0.0f) : _M_re(__x), _M_im(__y) {} - complex(const complex& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {} + complex(const complex& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {} inline explicit complex(const complex& __z); -# ifndef _STLP_NO_LONG_DOUBLE +# ifndef _STLP_NO_LONG_DOUBLE inline explicit complex(const complex& __z); -# endif +# endif // Element access. value_type real() const { return _M_re; } value_type imag() const { return _M_im; } @@ -212,7 +211,7 @@ _Self& operator= (value_type __x) { _M_re = __x; - _M_im = 0; + _M_im = 0.0f; return *this; } _Self& operator+= (value_type __x) { @@ -236,16 +235,15 @@ // Arithmetic op= operations involving two complex arguments. - _STLP_DECLSPEC static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i, + _STLP_DECLSPEC static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i, const float& __z2_r, const float& __z2_i, float& __res_r, float& __res_i); - - _STLP_DECLSPEC static void _STLP_CALL _div(const float& __z1_r, + + _STLP_DECLSPEC static void _STLP_CALL _div(const float& __z1_r, const float& __z2_r, const float& __z2_i, float& __res_r, float& __res_i); - -#if defined (_STLP_MEMBER_TEMPLATES) +# if defined (_STLP_MEMBER_TEMPLATES) template complex& operator=(const complex<_Tp2>& __z) { _M_re = __z._M_re; @@ -286,7 +284,7 @@ return *this; } -#endif /* _STLP_MEMBER_TEMPLATES */ +# endif /* _STLP_MEMBER_TEMPLATES */ _Self& operator=(const _Self& __z) { _M_re = __z._M_re; @@ -305,7 +303,7 @@ _M_im -= __z._M_im; return *this; } - + _Self& operator*= (const _Self& __z) { value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; @@ -328,7 +326,8 @@ value_type _M_im; }; -_STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex { +_STLP_TEMPLATE_NULL +struct _STLP_CLASS_DECLSPEC complex { typedef double value_type; typedef complex _Self; @@ -340,9 +339,9 @@ complex(const complex& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {} inline complex(const complex& __z); -# ifndef _STLP_NO_LONG_DOUBLE +# if !defined (_STLP_NO_LONG_DOUBLE) explicit inline complex(const complex& __z); -# endif +# endif // Element access. value_type real() const { return _M_re; } value_type imag() const { return _M_im; } @@ -351,7 +350,7 @@ _Self& operator= (value_type __x) { _M_re = __x; - _M_im = 0; + _M_im = 0.0; return *this; } _Self& operator+= (value_type __x) { @@ -378,12 +377,11 @@ _STLP_DECLSPEC static void _STLP_CALL _div(const double& __z1_r, const double& __z1_i, const double& __z2_r, const double& __z2_i, double& __res_r, double& __res_i); - _STLP_DECLSPEC static void _STLP_CALL _div(const double& __z1_r, + _STLP_DECLSPEC static void _STLP_CALL _div(const double& __z1_r, const double& __z2_r, const double& __z2_i, double& __res_r, double& __res_i); - -#if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) template complex& operator=(const complex<_Tp2>& __z) { _M_re = __z._M_re; @@ -424,7 +422,7 @@ return *this; } -#endif /* _STLP_MEMBER_TEMPLATES */ +# endif /* _STLP_MEMBER_TEMPLATES */ _Self& operator=(const _Self& __z) { _M_re = __z._M_re; @@ -443,7 +441,7 @@ _M_im -= __z._M_im; return *this; } - + _Self& operator*= (const _Self& __z) { value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; @@ -466,14 +464,15 @@ value_type _M_im; }; -# ifndef _STLP_NO_LONG_DOUBLE +# if !defined (_STLP_NO_LONG_DOUBLE) -_STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex { +_STLP_TEMPLATE_NULL +struct _STLP_CLASS_DECLSPEC complex { typedef long double value_type; typedef complex _Self; // Constructors, destructor, assignment operator. - complex(value_type __x = 0.0, value_type __y = 0.0) + complex(value_type __x = 0.0l, value_type __y = 0.0l) : _M_re(__x), _M_im(__y) {} complex(const complex& __z) @@ -489,7 +488,7 @@ _Self& operator= (value_type __x) { _M_re = __x; - _M_im = 0; + _M_im = 0.0l; return *this; } _Self& operator+= (value_type __x) { @@ -517,11 +516,11 @@ const long double& __z2_r, const long double& __z2_i, long double& __res_r, long double& __res_i); - _STLP_DECLSPEC static void _STLP_CALL _div(const long double& __z1_r, + _STLP_DECLSPEC static void _STLP_CALL _div(const long double& __z1_r, const long double& __z2_r, const long double& __z2_i, long double& __res_r, long double& __res_i); -#if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) template complex& operator=(const complex<_Tp2>& __z) { @@ -563,7 +562,7 @@ return *this; } -#endif /* _STLP_MEMBER_TEMPLATES */ +# endif /* _STLP_MEMBER_TEMPLATES */ _Self& operator=(const _Self& __z) { _M_re = __z._M_re; @@ -582,7 +581,7 @@ _M_im -= __z._M_im; return *this; } - + _Self& operator*= (const _Self& __z) { value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; @@ -605,73 +604,65 @@ value_type _M_im; }; -# endif /* _STLP_NO_LONG_DOUBLE */ +# endif /* _STLP_NO_LONG_DOUBLE */ // Converting constructors from one of these three specialized types // to another. inline complex::complex(const complex& __z) - : _M_re(__z._M_re), _M_im(__z._M_im) {} + : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {} inline complex::complex(const complex& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {} -# ifndef _STLP_NO_LONG_DOUBLE +# ifndef _STLP_NO_LONG_DOUBLE inline complex::complex(const complex& __z) - : _M_re(__z._M_re), _M_im(__z._M_im) {} + : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {} inline complex::complex(const complex& __z) - : _M_re(__z._M_re), _M_im(__z._M_im) {} + : _M_re((double)__z._M_re), _M_im((double)__z._M_im) {} inline complex::complex(const complex& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {} inline complex::complex(const complex& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {} -# endif +# endif -# endif /* SPECIALIZATIONS */ +#endif /* SPECIALIZATIONS */ // Unary non-member arithmetic operators. template -inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z) { - return __z; -} +inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z) +{ return __z; } template -inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z) { - return complex<_Tp>(-__z._M_re, -__z._M_im); -} +inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z) +{ return complex<_Tp>(-__z._M_re, -__z._M_im); } // Non-member arithmetic operations involving one real argument. -template -inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z) { - return complex<_Tp>(__x + __z._M_re, __z._M_im); -} +template +inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z) +{ return complex<_Tp>(__x + __z._M_re, __z._M_im); } -template -inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x) { - return complex<_Tp>(__z._M_re + __x, __z._M_im); -} +template +inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x) +{ return complex<_Tp>(__z._M_re + __x, __z._M_im); } -template -inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z) { - return complex<_Tp>(__x - __z._M_re, -__z._M_im); -} +template +inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z) +{ return complex<_Tp>(__x - __z._M_re, -__z._M_im); } -template -inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x) { - return complex<_Tp>(__z._M_re - __x, __z._M_im); -} +template +inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x) +{ return complex<_Tp>(__z._M_re - __x, __z._M_im); } -template -inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z) { - return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); -} +template +inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z) +{ return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); } -template -inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x) { - return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); -} +template +inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x) +{ return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); } -template +template inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) { complex<_Tp> __result; complex<_Tp>::_div(__x, @@ -680,34 +671,31 @@ return __result; } -template -inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x) { - return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); -} +template +inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x) +{ return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); } // Non-member arithmetic operations involving two complex arguments -template -inline complex<_Tp> _STLP_CALL -operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2) { - return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); -} +template +inline complex<_Tp> _STLP_CALL +operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2) +{ return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); } -template -inline complex<_Tp> _STLP_CALL -operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2) { - return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); -} +template +inline complex<_Tp> _STLP_CALL +operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2) +{ return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); } -template -inline complex<_Tp> _STLP_CALL +template +inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) { return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im, __z1._M_re * __z2._M_im + __z1._M_im * __z2._M_re); } -template -inline complex<_Tp> _STLP_CALL +template +inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) { complex<_Tp> __result; complex<_Tp>::_div(__z1._M_re, __z1._M_im, @@ -718,226 +706,186 @@ // Comparison operators. -template -inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2) { - return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im; -} +template +inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2) +{ return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im; } -template -inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x) { - return __z._M_re == __x && __z._M_im == 0; -} +template +inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x) +{ return __z._M_re == __x && __z._M_im == 0; } -template -inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z) { - return __x == __z._M_re && 0 == __z._M_im; -} +template +inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z) +{ return __x == __z._M_re && 0 == __z._M_im; } -#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER +//04/27/04 dums: removal of this check, if it is restablish +//please explain why the other operators are not macro guarded +//#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER -template -inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2) { - return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im; -} +template +inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2) +{ return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im; } -#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ +//#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ -template -inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x) { - return __z._M_re != __x || __z._M_im != 0; -} +template +inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x) +{ return __z._M_re != __x || __z._M_im != 0; } -template -inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z) { - return __x != __z._M_re || 0 != __z._M_im; -} +template +inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z) +{ return __x != __z._M_re || 0 != __z._M_im; } // Other basic arithmetic operations - -template -inline _Tp _STLP_CALL real(const complex<_Tp>& __z) { - return __z._M_re; -} - -template -inline _Tp _STLP_CALL imag(const complex<_Tp>& __z) { - return __z._M_im; -} - -#ifdef __SYMBIAN32__ template -#ifdef __WINSCW__ -_STLP_DECLSPEC -#endif -_Tp _STLP_CALL abs_tp(const complex<_Tp>&); +inline _Tp _STLP_CALL real(const complex<_Tp>& __z) +{ return __z._M_re; } template -#ifdef __WINSCW__ -_STLP_DECLSPEC -#endif -_Tp _STLP_CALL arg_tp(const complex<_Tp>&); +inline _Tp _STLP_CALL imag(const complex<_Tp>& __z) +{ return __z._M_im; } + +#if defined(__SYMBIAN32__) && defined (_STLP_DESIGNATED_DLL) && (__ARMCC_VERSION >= 220435 && __ARMCC_VERSION < 230000) //RVCT 2.2, __declspec(dllexport) should be there at declaration +template +_Tp _STLP_CALL _STLP_DECLSPEC abs(const complex<_Tp>& __z); template -#ifdef __WINSCW__ -_STLP_DECLSPEC -#endif -complex<_Tp> _STLP_CALL polar_tp(const _Tp& __rho, const _Tp& __phi); +_Tp _STLP_CALL _STLP_DECLSPEC arg(const complex<_Tp>& __z); +#else +template +_Tp _STLP_CALL abs(const complex<_Tp>& __z); + +template +_Tp _STLP_CALL arg(const complex<_Tp>& __z); +#endif //__SYMBIAN32__ && _STLP_DESIGNATED_DLL + +template +inline _Tp _STLP_CALL norm(const complex<_Tp>& __z) +{ return __z._M_re * __z._M_re + __z._M_im * __z._M_im; } + +template +inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z) +{ return complex<_Tp>(__z._M_re, -__z._M_im); } + +template +complex<_Tp> _STLP_CALL polar(const _Tp& __rho) +{ return complex<_Tp>(__rho, 0); } + +#if defined(__SYMBIAN32__) && defined (_STLP_DESIGNATED_DLL) && (__ARMCC_VERSION >= 220435 && __ARMCC_VERSION < 230000) +template +complex<_Tp> _STLP_CALL _STLP_DECLSPEC polar(const _Tp& __rho, const _Tp& __phi); +#else +template +complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi); +#endif //__SYMBIAN32__ && _STLP_DESIGNATED_DLL + + +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC float _STLP_CALL abs(const complex&); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC double _STLP_CALL abs(const complex&); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC float _STLP_CALL arg(const complex&); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC double _STLP_CALL arg(const complex&); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC complex _STLP_CALL polar(const float& __rho, const float& __phi); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC complex _STLP_CALL polar(const double& __rho, const double& __phi); template _Tp _STLP_CALL abs(const complex<_Tp>& __z) - { - return abs_tp(__z); - } +{ return _Tp(abs(complex(double(__z.real()), double(__z.imag())))); } template _Tp _STLP_CALL arg(const complex<_Tp>& __z) - { - return arg_tp(__z); - } +{ return _Tp(arg(complex(double(__z.real()), double(__z.imag())))); } template complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) { - return polar_tp(__rho, __phi); -} - -#else -template -_Tp _STLP_CALL abs(const complex<_Tp>& __z) { - return _Tp(abs(complex(double(__z.real()), double(__z.imag())))); -} - -template -_Tp _STLP_CALL arg(const complex<_Tp>& __z) { - return _Tp(arg(complex(double(__z.real()), double(__z.imag())))); -} - -#endif - - -template -inline _Tp _STLP_CALL norm(const complex<_Tp>& __z) { - return __z._M_re * __z._M_re + __z._M_im * __z._M_im; -} - -template -inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z) { - return complex<_Tp>(__z._M_re, -__z._M_im); -} - -template -complex<_Tp> _STLP_CALL polar(const _Tp& __rho) { - return complex<_Tp>(__rho, 0); -} - -#ifndef __SYMBIAN32__ -template -complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) { complex __tmp = polar(double(__rho), double(__phi)); return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag())); } - +#if !defined (_STLP_NO_LONG_DOUBLE) _STLP_TEMPLATE_NULL -_STLP_DECLSPEC float _STLP_CALL abs(const complex&); -#ifndef _STLP_COMPLEX_SPECIALIZATION_BUG +_STLP_DECLSPEC long double _STLP_CALL arg(const complex&); _STLP_TEMPLATE_NULL -_STLP_DECLSPEC double _STLP_CALL abs(const complex&); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC double _STLP_CALL arg(const complex&); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC complex _STLP_CALL polar(const double& __rho, const double& __phi); -#endif -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC float _STLP_CALL arg(const complex&); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC complex _STLP_CALL polar(const float& __rho, const float& __phi); - - -# ifndef _STLP_NO_LONG_DOUBLE -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC long double _STLP_CALL arg(const complex&); -_STLP_TEMPLATE_NULL -_STLP_DECLSPEC long double _STLP_CALL abs(const complex&); +_STLP_DECLSPEC long double _STLP_CALL abs(const complex&); _STLP_TEMPLATE_NULL _STLP_DECLSPEC complex _STLP_CALL polar(const long double&, const long double&); -# endif #endif -#ifdef _STLP_USE_NEW_IOSTREAMS +#if !defined (_STLP_USE_NO_IOSTREAMS) -// Complex output, in the form (re,im). We use a two-step process -// involving stringstream so that we get the padding right. +_STLP_END_NAMESPACE + +# include + +_STLP_BEGIN_NAMESPACE + +// Complex output, in the form (re,im). We use a two-step process +// involving stringstream so that we get the padding right. template -basic_ostream<_CharT, _Traits>& _STLP_CALL +basic_ostream<_CharT, _Traits>& _STLP_CALL operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z); template -basic_istream<_CharT, _Traits>& _STLP_CALL +basic_istream<_CharT, _Traits>& _STLP_CALL operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z); // Specializations for narrow characters; lets us avoid widen. _STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_istream >& _STLP_CALL +_STLP_DECLSPEC basic_istream >& _STLP_CALL operator>>(basic_istream >& __is, complex& __z); _STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_istream >& _STLP_CALL +_STLP_DECLSPEC basic_istream >& _STLP_CALL operator>>(basic_istream >& __is, complex& __z); - _STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_ostream >& _STLP_CALL +_STLP_DECLSPEC basic_ostream >& _STLP_CALL operator<<(basic_ostream >& __is, const complex& __z); _STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_ostream >& _STLP_CALL +_STLP_DECLSPEC basic_ostream >& _STLP_CALL operator<<(basic_ostream >& __is, const complex& __z); -# if ! defined (_STLP_NO_LONG_DOUBLE) +# if !defined (_STLP_NO_LONG_DOUBLE) _STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_istream >& _STLP_CALL +_STLP_DECLSPEC basic_istream >& _STLP_CALL operator>>(basic_istream >& __is, complex& __z); _STLP_OPERATOR_TEMPLATE -_STLP_DECLSPEC basic_ostream >& _STLP_CALL +_STLP_DECLSPEC basic_ostream >& _STLP_CALL operator<<(basic_ostream >& __is, const complex& __z); -# endif - -# if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T) - -_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL operator>>( - basic_istream >&, complex&); -_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL operator<<( - basic_ostream >&, const complex&); -_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL operator>>( - basic_istream >&, complex&); -_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL operator<<( - basic_ostream >&, const complex&); - -# ifndef _STLP_NO_LONG_DOUBLE -_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL operator>>( - basic_istream >&, complex&); -_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL operator<<( - basic_ostream >&, const complex&); # endif -# endif /* USE_TEMPLATE_EXPORT */ +# if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T) -#else /* _STLP_USE_NEW_IOSTREAMS */ +_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL +operator>>(basic_istream >&, complex&); +_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL +operator<<(basic_ostream >&, const complex&); +_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL +operator>>(basic_istream >&, complex&); +_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL +operator<<(basic_ostream >&, const complex&); -template -ostream& _STLP_CALL operator<<(ostream& s, const complex<_Tp>& __z); +# if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL +operator>>(basic_istream >&, complex&); +_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL +operator<<(basic_ostream >&, const complex&); +# endif +# endif +#endif -template -istream& _STLP_CALL operator>>(istream& s, complex<_Tp>& a); -#endif /* _STLP_USE_NEW_IOSTREAMS */ - - -// Transcendental functions. These are defined only for float, +// Transcendental functions. These are defined only for float, // double, and long double. (Sqrt isn't transcendental, of course, // but it's included in this section anyway.) @@ -979,7 +927,7 @@ _STLP_DECLSPEC complex _STLP_CALL cosh(const complex&); _STLP_DECLSPEC complex _STLP_CALL tanh(const complex&); -# ifndef _STLP_NO_LONG_DOUBLE +#if !defined (_STLP_NO_LONG_DOUBLE) _STLP_DECLSPEC complex _STLP_CALL sqrt(const complex&); _STLP_DECLSPEC complex _STLP_CALL exp(const complex&); _STLP_DECLSPEC complex _STLP_CALL log(const complex&); @@ -998,15 +946,15 @@ _STLP_DECLSPEC complex _STLP_CALL sinh(const complex&); _STLP_DECLSPEC complex _STLP_CALL cosh(const complex&); _STLP_DECLSPEC complex _STLP_CALL tanh(const complex&); -# endif +#endif _STLP_END_NAMESPACE -# ifndef _STLP_LINK_TIME_INSTANTIATION +#ifndef _STLP_LINK_TIME_INSTANTIATION # include -# endif +#endif -#endif /* _STLP_template_complex */ +#endif // Local Variables: // mode:C++