1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_complex.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_complex.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -2,45 +2,46 @@
1.4 * Copyright (c) 1999
1.5 * Silicon Graphics Computer Systems, Inc.
1.6 *
1.7 - * Copyright (c) 1999
1.8 + * Copyright (c) 1999
1.9 * Boris Fomitchev
1.10 *
1.11 * This material is provided "as is", with absolutely no warranty expressed
1.12 * or implied. Any use is at your own risk.
1.13 *
1.14 - * Permission to use or copy this software for any purpose is hereby granted
1.15 + * Permission to use or copy this software for any purpose is hereby granted
1.16 * without fee, provided the above notices are retained on all copies.
1.17 * Permission to modify the code and to distribute modified code is granted,
1.18 * provided the above notices are retained, and a notice that the code was
1.19 * modified is included with the above copyright notice.
1.20 *
1.21 - */
1.22 -#ifndef _STLP_internal_complex_h
1.23 -#define _STLP_internal_complex_h
1.24 + */
1.25 +#ifndef _STLP_INTERNAL_COMPLEX
1.26 +#define _STLP_INTERNAL_COMPLEX
1.27
1.28 -// This header declares the template class complex, as described in
1.29 +// This header declares the template class complex, as described in
1.30 // in the draft C++ standard. Single-precision complex numbers
1.31 // are complex<float>, double-precision are complex<double>, and
1.32 // quad precision are complex<long double>.
1.33
1.34 // Note that the template class complex is declared within namespace
1.35 -// std, as called for by the draft C++ standard.
1.36 +// std, as called for by the draft C++ standard.
1.37
1.38 -#include <stl/_cmath.h>
1.39 -#include <iosfwd>
1.40 +#ifndef _STLP_INTERNAL_CMATH
1.41 +# include <stl/_cmath.h>
1.42 +#endif
1.43
1.44 _STLP_BEGIN_NAMESPACE
1.45
1.46 -#if !defined(_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
1.47 +#if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
1.48
1.49 template <class _Tp> struct complex;
1.50
1.51 -_STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<float>;
1.52 -_STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<double>;
1.53 -# ifndef _STLP_NO_LONG_DOUBLE
1.54 -_STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<long double>;
1.55 -# endif
1.56 -# endif
1.57 +_STLP_TEMPLATE_NULL struct complex<float>;
1.58 +_STLP_TEMPLATE_NULL struct complex<double>;
1.59 +# if !defined (_STLP_NO_LONG_DOUBLE)
1.60 +_STLP_TEMPLATE_NULL struct complex<long double>;
1.61 +# endif
1.62 +#endif /* _STLP_NO_COMPLEX_SPECIALIZATIONS */
1.63
1.64 template <class _Tp>
1.65 struct complex {
1.66 @@ -62,7 +63,7 @@
1.67 return *this;
1.68 }
1.69
1.70 -#if defined (_STLP_MEMBER_TEMPLATES) && ( defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined(_STLP_NO_COMPLEX_SPECIALIZATIONS))
1.71 +#if defined (_STLP_MEMBER_TEMPLATES) && (defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined(_STLP_NO_COMPLEX_SPECIALIZATIONS))
1.72 template <class _Tp2>
1.73 explicit complex(const complex<_Tp2>& __z)
1.74 : _M_re(__z._M_re), _M_im(__z._M_im) {}
1.75 @@ -108,14 +109,14 @@
1.76 // Arithmetic op= operations involving two complex arguments.
1.77
1.78 static void _STLP_CALL _div(const value_type& __z1_r, const value_type& __z1_i,
1.79 - const value_type& __z2_r, const value_type& __z2_i,
1.80 - value_type& __res_r, value_type& __res_i);
1.81 + const value_type& __z2_r, const value_type& __z2_i,
1.82 + value_type& __res_r, value_type& __res_i);
1.83
1.84 - static void _STLP_CALL _div(const value_type& __z1_r,
1.85 - const value_type& __z2_r, const value_type& __z2_i,
1.86 - value_type& __res_r, value_type& __res_i);
1.87 + static void _STLP_CALL _div(const value_type& __z1_r,
1.88 + const value_type& __z2_r, const value_type& __z2_i,
1.89 + value_type& __res_r, value_type& __res_i);
1.90
1.91 -#if defined ( _STLP_MEMBER_TEMPLATES ) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
1.92 +#if defined (_STLP_MEMBER_TEMPLATES) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
1.93
1.94 template <class _Tp2> _Self& operator+= (const complex<_Tp2>& __z) {
1.95 _M_re += __z._M_re;
1.96 @@ -145,7 +146,6 @@
1.97 _M_im = __i;
1.98 return *this;
1.99 }
1.100 -
1.101 #endif /* _STLP_MEMBER_TEMPLATES */
1.102
1.103 _Self& operator+= (const _Self& __z) {
1.104 @@ -159,7 +159,7 @@
1.105 _M_im -= __z._M_im;
1.106 return *this;
1.107 }
1.108 -
1.109 +
1.110 _Self& operator*= (const _Self& __z) {
1.111 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
1.112 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
1.113 @@ -182,28 +182,27 @@
1.114 value_type _M_im;
1.115 };
1.116
1.117 -#if !defined(_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
1.118 +#if !defined (_STLP_NO_COMPLEX_SPECIALIZATIONS) //*TY 02/25/2000 - added for MPW compiler workaround
1.119 // Explicit specializations for float, double, long double. The only
1.120 // reason for these specializations is to enable automatic conversions
1.121 // from complex<float> to complex<double>, and complex<double> to
1.122 // complex<long double>.
1.123
1.124 -
1.125 _STLP_TEMPLATE_NULL
1.126 struct _STLP_CLASS_DECLSPEC complex<float> {
1.127 typedef float value_type;
1.128 typedef complex<float> _Self;
1.129 // Constructors, destructor, assignment operator.
1.130
1.131 - complex(value_type __x = 0.0, value_type __y = 0.0)
1.132 + complex(value_type __x = 0.0f, value_type __y = 0.0f)
1.133 : _M_re(__x), _M_im(__y) {}
1.134
1.135 - complex(const complex<float>& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {}
1.136 + complex(const complex<float>& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {}
1.137
1.138 inline explicit complex(const complex<double>& __z);
1.139 -# ifndef _STLP_NO_LONG_DOUBLE
1.140 +# ifndef _STLP_NO_LONG_DOUBLE
1.141 inline explicit complex(const complex<long double>& __z);
1.142 -# endif
1.143 +# endif
1.144 // Element access.
1.145 value_type real() const { return _M_re; }
1.146 value_type imag() const { return _M_im; }
1.147 @@ -212,7 +211,7 @@
1.148
1.149 _Self& operator= (value_type __x) {
1.150 _M_re = __x;
1.151 - _M_im = 0;
1.152 + _M_im = 0.0f;
1.153 return *this;
1.154 }
1.155 _Self& operator+= (value_type __x) {
1.156 @@ -236,16 +235,15 @@
1.157
1.158 // Arithmetic op= operations involving two complex arguments.
1.159
1.160 - _STLP_DECLSPEC static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i,
1.161 + _STLP_DECLSPEC static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i,
1.162 const float& __z2_r, const float& __z2_i,
1.163 float& __res_r, float& __res_i);
1.164 -
1.165 - _STLP_DECLSPEC static void _STLP_CALL _div(const float& __z1_r,
1.166 +
1.167 + _STLP_DECLSPEC static void _STLP_CALL _div(const float& __z1_r,
1.168 const float& __z2_r, const float& __z2_i,
1.169 float& __res_r, float& __res_i);
1.170 -
1.171 -#if defined (_STLP_MEMBER_TEMPLATES)
1.172
1.173 +# if defined (_STLP_MEMBER_TEMPLATES)
1.174 template <class _Tp2>
1.175 complex<float>& operator=(const complex<_Tp2>& __z) {
1.176 _M_re = __z._M_re;
1.177 @@ -286,7 +284,7 @@
1.178 return *this;
1.179 }
1.180
1.181 -#endif /* _STLP_MEMBER_TEMPLATES */
1.182 +# endif /* _STLP_MEMBER_TEMPLATES */
1.183
1.184 _Self& operator=(const _Self& __z) {
1.185 _M_re = __z._M_re;
1.186 @@ -305,7 +303,7 @@
1.187 _M_im -= __z._M_im;
1.188 return *this;
1.189 }
1.190 -
1.191 +
1.192 _Self& operator*= (const _Self& __z) {
1.193 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
1.194 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
1.195 @@ -328,7 +326,8 @@
1.196 value_type _M_im;
1.197 };
1.198
1.199 -_STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<double> {
1.200 +_STLP_TEMPLATE_NULL
1.201 +struct _STLP_CLASS_DECLSPEC complex<double> {
1.202 typedef double value_type;
1.203 typedef complex<double> _Self;
1.204
1.205 @@ -340,9 +339,9 @@
1.206 complex(const complex<double>& __z)
1.207 : _M_re(__z._M_re), _M_im(__z._M_im) {}
1.208 inline complex(const complex<float>& __z);
1.209 -# ifndef _STLP_NO_LONG_DOUBLE
1.210 +# if !defined (_STLP_NO_LONG_DOUBLE)
1.211 explicit inline complex(const complex<long double>& __z);
1.212 -# endif
1.213 +# endif
1.214 // Element access.
1.215 value_type real() const { return _M_re; }
1.216 value_type imag() const { return _M_im; }
1.217 @@ -351,7 +350,7 @@
1.218
1.219 _Self& operator= (value_type __x) {
1.220 _M_re = __x;
1.221 - _M_im = 0;
1.222 + _M_im = 0.0;
1.223 return *this;
1.224 }
1.225 _Self& operator+= (value_type __x) {
1.226 @@ -378,12 +377,11 @@
1.227 _STLP_DECLSPEC static void _STLP_CALL _div(const double& __z1_r, const double& __z1_i,
1.228 const double& __z2_r, const double& __z2_i,
1.229 double& __res_r, double& __res_i);
1.230 - _STLP_DECLSPEC static void _STLP_CALL _div(const double& __z1_r,
1.231 + _STLP_DECLSPEC static void _STLP_CALL _div(const double& __z1_r,
1.232 const double& __z2_r, const double& __z2_i,
1.233 double& __res_r, double& __res_i);
1.234 -
1.235 -#if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
1.236
1.237 +# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
1.238 template <class _Tp2>
1.239 complex<double>& operator=(const complex<_Tp2>& __z) {
1.240 _M_re = __z._M_re;
1.241 @@ -424,7 +422,7 @@
1.242 return *this;
1.243 }
1.244
1.245 -#endif /* _STLP_MEMBER_TEMPLATES */
1.246 +# endif /* _STLP_MEMBER_TEMPLATES */
1.247
1.248 _Self& operator=(const _Self& __z) {
1.249 _M_re = __z._M_re;
1.250 @@ -443,7 +441,7 @@
1.251 _M_im -= __z._M_im;
1.252 return *this;
1.253 }
1.254 -
1.255 +
1.256 _Self& operator*= (const _Self& __z) {
1.257 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
1.258 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
1.259 @@ -466,14 +464,15 @@
1.260 value_type _M_im;
1.261 };
1.262
1.263 -# ifndef _STLP_NO_LONG_DOUBLE
1.264 +# if !defined (_STLP_NO_LONG_DOUBLE)
1.265
1.266 -_STLP_TEMPLATE_NULL struct _STLP_CLASS_DECLSPEC complex<long double> {
1.267 +_STLP_TEMPLATE_NULL
1.268 +struct _STLP_CLASS_DECLSPEC complex<long double> {
1.269 typedef long double value_type;
1.270 typedef complex<long double> _Self;
1.271
1.272 // Constructors, destructor, assignment operator.
1.273 - complex(value_type __x = 0.0, value_type __y = 0.0)
1.274 + complex(value_type __x = 0.0l, value_type __y = 0.0l)
1.275 : _M_re(__x), _M_im(__y) {}
1.276
1.277 complex(const complex<long double>& __z)
1.278 @@ -489,7 +488,7 @@
1.279
1.280 _Self& operator= (value_type __x) {
1.281 _M_re = __x;
1.282 - _M_im = 0;
1.283 + _M_im = 0.0l;
1.284 return *this;
1.285 }
1.286 _Self& operator+= (value_type __x) {
1.287 @@ -517,11 +516,11 @@
1.288 const long double& __z2_r, const long double& __z2_i,
1.289 long double& __res_r, long double& __res_i);
1.290
1.291 - _STLP_DECLSPEC static void _STLP_CALL _div(const long double& __z1_r,
1.292 + _STLP_DECLSPEC static void _STLP_CALL _div(const long double& __z1_r,
1.293 const long double& __z2_r, const long double& __z2_i,
1.294 long double& __res_r, long double& __res_i);
1.295
1.296 -#if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
1.297 +# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
1.298
1.299 template <class _Tp2>
1.300 complex<long double>& operator=(const complex<_Tp2>& __z) {
1.301 @@ -563,7 +562,7 @@
1.302 return *this;
1.303 }
1.304
1.305 -#endif /* _STLP_MEMBER_TEMPLATES */
1.306 +# endif /* _STLP_MEMBER_TEMPLATES */
1.307
1.308 _Self& operator=(const _Self& __z) {
1.309 _M_re = __z._M_re;
1.310 @@ -582,7 +581,7 @@
1.311 _M_im -= __z._M_im;
1.312 return *this;
1.313 }
1.314 -
1.315 +
1.316 _Self& operator*= (const _Self& __z) {
1.317 value_type __r = _M_re * __z._M_re - _M_im * __z._M_im;
1.318 value_type __i = _M_re * __z._M_im + _M_im * __z._M_re;
1.319 @@ -605,73 +604,65 @@
1.320 value_type _M_im;
1.321 };
1.322
1.323 -# endif /* _STLP_NO_LONG_DOUBLE */
1.324 +# endif /* _STLP_NO_LONG_DOUBLE */
1.325
1.326 // Converting constructors from one of these three specialized types
1.327 // to another.
1.328
1.329 inline complex<float>::complex(const complex<double>& __z)
1.330 - : _M_re(__z._M_re), _M_im(__z._M_im) {}
1.331 + : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
1.332 inline complex<double>::complex(const complex<float>& __z)
1.333 : _M_re(__z._M_re), _M_im(__z._M_im) {}
1.334 -# ifndef _STLP_NO_LONG_DOUBLE
1.335 +# ifndef _STLP_NO_LONG_DOUBLE
1.336 inline complex<float>::complex(const complex<long double>& __z)
1.337 - : _M_re(__z._M_re), _M_im(__z._M_im) {}
1.338 + : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {}
1.339 inline complex<double>::complex(const complex<long double>& __z)
1.340 - : _M_re(__z._M_re), _M_im(__z._M_im) {}
1.341 + : _M_re((double)__z._M_re), _M_im((double)__z._M_im) {}
1.342 inline complex<long double>::complex(const complex<float>& __z)
1.343 : _M_re(__z._M_re), _M_im(__z._M_im) {}
1.344 inline complex<long double>::complex(const complex<double>& __z)
1.345 : _M_re(__z._M_re), _M_im(__z._M_im) {}
1.346 -# endif
1.347 +# endif
1.348
1.349 -# endif /* SPECIALIZATIONS */
1.350 +#endif /* SPECIALIZATIONS */
1.351
1.352 // Unary non-member arithmetic operators.
1.353
1.354 template <class _Tp>
1.355 -inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z) {
1.356 - return __z;
1.357 -}
1.358 +inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z)
1.359 +{ return __z; }
1.360
1.361 template <class _Tp>
1.362 -inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z) {
1.363 - return complex<_Tp>(-__z._M_re, -__z._M_im);
1.364 -}
1.365 +inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z)
1.366 +{ return complex<_Tp>(-__z._M_re, -__z._M_im); }
1.367
1.368 // Non-member arithmetic operations involving one real argument.
1.369
1.370 -template <class _Tp>
1.371 -inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z) {
1.372 - return complex<_Tp>(__x + __z._M_re, __z._M_im);
1.373 -}
1.374 +template <class _Tp>
1.375 +inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z)
1.376 +{ return complex<_Tp>(__x + __z._M_re, __z._M_im); }
1.377
1.378 -template <class _Tp>
1.379 -inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x) {
1.380 - return complex<_Tp>(__z._M_re + __x, __z._M_im);
1.381 -}
1.382 +template <class _Tp>
1.383 +inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x)
1.384 +{ return complex<_Tp>(__z._M_re + __x, __z._M_im); }
1.385
1.386 -template <class _Tp>
1.387 -inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z) {
1.388 - return complex<_Tp>(__x - __z._M_re, -__z._M_im);
1.389 -}
1.390 +template <class _Tp>
1.391 +inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z)
1.392 +{ return complex<_Tp>(__x - __z._M_re, -__z._M_im); }
1.393
1.394 -template <class _Tp>
1.395 -inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x) {
1.396 - return complex<_Tp>(__z._M_re - __x, __z._M_im);
1.397 -}
1.398 +template <class _Tp>
1.399 +inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x)
1.400 +{ return complex<_Tp>(__z._M_re - __x, __z._M_im); }
1.401
1.402 -template <class _Tp>
1.403 -inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z) {
1.404 - return complex<_Tp>(__x * __z._M_re, __x * __z._M_im);
1.405 -}
1.406 +template <class _Tp>
1.407 +inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z)
1.408 +{ return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); }
1.409
1.410 -template <class _Tp>
1.411 -inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x) {
1.412 - return complex<_Tp>(__z._M_re * __x, __z._M_im * __x);
1.413 -}
1.414 +template <class _Tp>
1.415 +inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x)
1.416 +{ return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); }
1.417
1.418 -template <class _Tp>
1.419 +template <class _Tp>
1.420 inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) {
1.421 complex<_Tp> __result;
1.422 complex<_Tp>::_div(__x,
1.423 @@ -680,34 +671,31 @@
1.424 return __result;
1.425 }
1.426
1.427 -template <class _Tp>
1.428 -inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x) {
1.429 - return complex<_Tp>(__z._M_re / __x, __z._M_im / __x);
1.430 -}
1.431 +template <class _Tp>
1.432 +inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x)
1.433 +{ return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); }
1.434
1.435 // Non-member arithmetic operations involving two complex arguments
1.436
1.437 -template <class _Tp>
1.438 -inline complex<_Tp> _STLP_CALL
1.439 -operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
1.440 - return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im);
1.441 -}
1.442 +template <class _Tp>
1.443 +inline complex<_Tp> _STLP_CALL
1.444 +operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
1.445 +{ return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); }
1.446
1.447 -template <class _Tp>
1.448 -inline complex<_Tp> _STLP_CALL
1.449 -operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
1.450 - return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im);
1.451 -}
1.452 +template <class _Tp>
1.453 +inline complex<_Tp> _STLP_CALL
1.454 +operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
1.455 +{ return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); }
1.456
1.457 -template <class _Tp>
1.458 -inline complex<_Tp> _STLP_CALL
1.459 +template <class _Tp>
1.460 +inline complex<_Tp> _STLP_CALL
1.461 operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
1.462 return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im,
1.463 __z1._M_re * __z2._M_im + __z1._M_im * __z2._M_re);
1.464 }
1.465
1.466 -template <class _Tp>
1.467 -inline complex<_Tp> _STLP_CALL
1.468 +template <class _Tp>
1.469 +inline complex<_Tp> _STLP_CALL
1.470 operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
1.471 complex<_Tp> __result;
1.472 complex<_Tp>::_div(__z1._M_re, __z1._M_im,
1.473 @@ -718,226 +706,186 @@
1.474
1.475 // Comparison operators.
1.476
1.477 -template <class _Tp>
1.478 -inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
1.479 - return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im;
1.480 -}
1.481 +template <class _Tp>
1.482 +inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
1.483 +{ return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im; }
1.484
1.485 -template <class _Tp>
1.486 -inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x) {
1.487 - return __z._M_re == __x && __z._M_im == 0;
1.488 -}
1.489 +template <class _Tp>
1.490 +inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x)
1.491 +{ return __z._M_re == __x && __z._M_im == 0; }
1.492
1.493 -template <class _Tp>
1.494 -inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z) {
1.495 - return __x == __z._M_re && 0 == __z._M_im;
1.496 -}
1.497 +template <class _Tp>
1.498 +inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z)
1.499 +{ return __x == __z._M_re && 0 == __z._M_im; }
1.500
1.501 -#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
1.502 +//04/27/04 dums: removal of this check, if it is restablish
1.503 +//please explain why the other operators are not macro guarded
1.504 +//#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER
1.505
1.506 -template <class _Tp>
1.507 -inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2) {
1.508 - return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im;
1.509 -}
1.510 +template <class _Tp>
1.511 +inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2)
1.512 +{ return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im; }
1.513
1.514 -#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
1.515 +//#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */
1.516
1.517 -template <class _Tp>
1.518 -inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x) {
1.519 - return __z._M_re != __x || __z._M_im != 0;
1.520 -}
1.521 +template <class _Tp>
1.522 +inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x)
1.523 +{ return __z._M_re != __x || __z._M_im != 0; }
1.524
1.525 -template <class _Tp>
1.526 -inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z) {
1.527 - return __x != __z._M_re || 0 != __z._M_im;
1.528 -}
1.529 +template <class _Tp>
1.530 +inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z)
1.531 +{ return __x != __z._M_re || 0 != __z._M_im; }
1.532
1.533 // Other basic arithmetic operations
1.534 -
1.535 -template <class _Tp>
1.536 -inline _Tp _STLP_CALL real(const complex<_Tp>& __z) {
1.537 - return __z._M_re;
1.538 -}
1.539 -
1.540 -template <class _Tp>
1.541 -inline _Tp _STLP_CALL imag(const complex<_Tp>& __z) {
1.542 - return __z._M_im;
1.543 -}
1.544 -
1.545 -#ifdef __SYMBIAN32__
1.546 template <class _Tp>
1.547 -#ifdef __WINSCW__
1.548 -_STLP_DECLSPEC
1.549 -#endif
1.550 -_Tp _STLP_CALL abs_tp(const complex<_Tp>&);
1.551 +inline _Tp _STLP_CALL real(const complex<_Tp>& __z)
1.552 +{ return __z._M_re; }
1.553
1.554 template <class _Tp>
1.555 -#ifdef __WINSCW__
1.556 -_STLP_DECLSPEC
1.557 -#endif
1.558 -_Tp _STLP_CALL arg_tp(const complex<_Tp>&);
1.559 +inline _Tp _STLP_CALL imag(const complex<_Tp>& __z)
1.560 +{ return __z._M_im; }
1.561 +
1.562 +#if defined(__SYMBIAN32__) && defined (_STLP_DESIGNATED_DLL) && (__ARMCC_VERSION >= 220435 && __ARMCC_VERSION < 230000) //RVCT 2.2, __declspec(dllexport) should be there at declaration
1.563 +template <class _Tp>
1.564 +_Tp _STLP_CALL _STLP_DECLSPEC abs(const complex<_Tp>& __z);
1.565
1.566 template <class _Tp>
1.567 -#ifdef __WINSCW__
1.568 -_STLP_DECLSPEC
1.569 -#endif
1.570 -complex<_Tp> _STLP_CALL polar_tp(const _Tp& __rho, const _Tp& __phi);
1.571 +_Tp _STLP_CALL _STLP_DECLSPEC arg(const complex<_Tp>& __z);
1.572 +#else
1.573 +template <class _Tp>
1.574 +_Tp _STLP_CALL abs(const complex<_Tp>& __z);
1.575 +
1.576 +template <class _Tp>
1.577 +_Tp _STLP_CALL arg(const complex<_Tp>& __z);
1.578 +#endif //__SYMBIAN32__ && _STLP_DESIGNATED_DLL
1.579 +
1.580 +template <class _Tp>
1.581 +inline _Tp _STLP_CALL norm(const complex<_Tp>& __z)
1.582 +{ return __z._M_re * __z._M_re + __z._M_im * __z._M_im; }
1.583 +
1.584 +template <class _Tp>
1.585 +inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z)
1.586 +{ return complex<_Tp>(__z._M_re, -__z._M_im); }
1.587 +
1.588 +template <class _Tp>
1.589 +complex<_Tp> _STLP_CALL polar(const _Tp& __rho)
1.590 +{ return complex<_Tp>(__rho, 0); }
1.591 +
1.592 +#if defined(__SYMBIAN32__) && defined (_STLP_DESIGNATED_DLL) && (__ARMCC_VERSION >= 220435 && __ARMCC_VERSION < 230000)
1.593 +template <class _Tp>
1.594 +complex<_Tp> _STLP_CALL _STLP_DECLSPEC polar(const _Tp& __rho, const _Tp& __phi);
1.595 +#else
1.596 +template <class _Tp>
1.597 +complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi);
1.598 +#endif //__SYMBIAN32__ && _STLP_DESIGNATED_DLL
1.599 +
1.600 +
1.601 +_STLP_TEMPLATE_NULL
1.602 +_STLP_DECLSPEC float _STLP_CALL abs(const complex<float>&);
1.603 +_STLP_TEMPLATE_NULL
1.604 +_STLP_DECLSPEC double _STLP_CALL abs(const complex<double>&);
1.605 +_STLP_TEMPLATE_NULL
1.606 +_STLP_DECLSPEC float _STLP_CALL arg(const complex<float>&);
1.607 +_STLP_TEMPLATE_NULL
1.608 +_STLP_DECLSPEC double _STLP_CALL arg(const complex<double>&);
1.609 +_STLP_TEMPLATE_NULL
1.610 +_STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi);
1.611 +_STLP_TEMPLATE_NULL
1.612 +_STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi);
1.613
1.614 template <class _Tp>
1.615 _Tp _STLP_CALL abs(const complex<_Tp>& __z)
1.616 - {
1.617 - return abs_tp(__z);
1.618 - }
1.619 +{ return _Tp(abs(complex<double>(double(__z.real()), double(__z.imag())))); }
1.620
1.621 template <class _Tp>
1.622 _Tp _STLP_CALL arg(const complex<_Tp>& __z)
1.623 - {
1.624 - return arg_tp(__z);
1.625 - }
1.626 +{ return _Tp(arg(complex<double>(double(__z.real()), double(__z.imag())))); }
1.627
1.628 template <class _Tp>
1.629 complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
1.630 - return polar_tp(__rho, __phi);
1.631 -}
1.632 -
1.633 -#else
1.634 -template <class _Tp>
1.635 -_Tp _STLP_CALL abs(const complex<_Tp>& __z) {
1.636 - return _Tp(abs(complex<double>(double(__z.real()), double(__z.imag()))));
1.637 -}
1.638 -
1.639 -template <class _Tp>
1.640 -_Tp _STLP_CALL arg(const complex<_Tp>& __z) {
1.641 - return _Tp(arg(complex<double>(double(__z.real()), double(__z.imag()))));
1.642 -}
1.643 -
1.644 -#endif
1.645 -
1.646 -
1.647 -template <class _Tp>
1.648 -inline _Tp _STLP_CALL norm(const complex<_Tp>& __z) {
1.649 - return __z._M_re * __z._M_re + __z._M_im * __z._M_im;
1.650 -}
1.651 -
1.652 -template <class _Tp>
1.653 -inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z) {
1.654 - return complex<_Tp>(__z._M_re, -__z._M_im);
1.655 -}
1.656 -
1.657 -template <class _Tp>
1.658 -complex<_Tp> _STLP_CALL polar(const _Tp& __rho) {
1.659 - return complex<_Tp>(__rho, 0);
1.660 -}
1.661 -
1.662 -#ifndef __SYMBIAN32__
1.663 -template <class _Tp>
1.664 -complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) {
1.665 complex<double> __tmp = polar(double(__rho), double(__phi));
1.666 return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag()));
1.667 }
1.668
1.669 -
1.670 +#if !defined (_STLP_NO_LONG_DOUBLE)
1.671 _STLP_TEMPLATE_NULL
1.672 -_STLP_DECLSPEC float _STLP_CALL abs(const complex<float>&);
1.673 -#ifndef _STLP_COMPLEX_SPECIALIZATION_BUG
1.674 +_STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>&);
1.675 _STLP_TEMPLATE_NULL
1.676 -_STLP_DECLSPEC double _STLP_CALL abs(const complex<double>&);
1.677 -_STLP_TEMPLATE_NULL
1.678 -_STLP_DECLSPEC double _STLP_CALL arg(const complex<double>&);
1.679 -_STLP_TEMPLATE_NULL
1.680 -_STLP_DECLSPEC complex<double> _STLP_CALL polar(const double& __rho, const double& __phi);
1.681 -#endif
1.682 -_STLP_TEMPLATE_NULL
1.683 -_STLP_DECLSPEC float _STLP_CALL arg(const complex<float>&);
1.684 -_STLP_TEMPLATE_NULL
1.685 -_STLP_DECLSPEC complex<float> _STLP_CALL polar(const float& __rho, const float& __phi);
1.686 -
1.687 -
1.688 -# ifndef _STLP_NO_LONG_DOUBLE
1.689 -_STLP_TEMPLATE_NULL
1.690 -_STLP_DECLSPEC long double _STLP_CALL arg(const complex<long double>&);
1.691 -_STLP_TEMPLATE_NULL
1.692 -_STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>&);
1.693 +_STLP_DECLSPEC long double _STLP_CALL abs(const complex<long double>&);
1.694 _STLP_TEMPLATE_NULL
1.695 _STLP_DECLSPEC complex<long double> _STLP_CALL polar(const long double&, const long double&);
1.696 -# endif
1.697 #endif
1.698
1.699
1.700 -#ifdef _STLP_USE_NEW_IOSTREAMS
1.701 +#if !defined (_STLP_USE_NO_IOSTREAMS)
1.702
1.703 -// Complex output, in the form (re,im). We use a two-step process
1.704 -// involving stringstream so that we get the padding right.
1.705 +_STLP_END_NAMESPACE
1.706 +
1.707 +# include <iosfwd>
1.708 +
1.709 +_STLP_BEGIN_NAMESPACE
1.710 +
1.711 +// Complex output, in the form (re,im). We use a two-step process
1.712 +// involving stringstream so that we get the padding right.
1.713 template <class _Tp, class _CharT, class _Traits>
1.714 -basic_ostream<_CharT, _Traits>& _STLP_CALL
1.715 +basic_ostream<_CharT, _Traits>& _STLP_CALL
1.716 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z);
1.717
1.718 template <class _Tp, class _CharT, class _Traits>
1.719 -basic_istream<_CharT, _Traits>& _STLP_CALL
1.720 +basic_istream<_CharT, _Traits>& _STLP_CALL
1.721 operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z);
1.722
1.723 // Specializations for narrow characters; lets us avoid widen.
1.724
1.725 _STLP_OPERATOR_TEMPLATE
1.726 -_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
1.727 +_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
1.728 operator>>(basic_istream<char, char_traits<char> >& __is, complex<float>& __z);
1.729
1.730 _STLP_OPERATOR_TEMPLATE
1.731 -_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
1.732 +_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
1.733 operator>>(basic_istream<char, char_traits<char> >& __is, complex<double>& __z);
1.734
1.735 -
1.736 _STLP_OPERATOR_TEMPLATE
1.737 -_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
1.738 +_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
1.739 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<float>& __z);
1.740
1.741 _STLP_OPERATOR_TEMPLATE
1.742 -_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
1.743 +_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
1.744 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<double>& __z);
1.745
1.746 -# if ! defined (_STLP_NO_LONG_DOUBLE)
1.747 +# if !defined (_STLP_NO_LONG_DOUBLE)
1.748 _STLP_OPERATOR_TEMPLATE
1.749 -_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
1.750 +_STLP_DECLSPEC basic_istream<char, char_traits<char> >& _STLP_CALL
1.751 operator>>(basic_istream<char, char_traits<char> >& __is, complex<long double>& __z);
1.752
1.753 _STLP_OPERATOR_TEMPLATE
1.754 -_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
1.755 +_STLP_DECLSPEC basic_ostream<char, char_traits<char> >& _STLP_CALL
1.756 operator<<(basic_ostream<char, char_traits<char> >& __is, const complex<long double>& __z);
1.757
1.758 -# endif
1.759 -
1.760 -# if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T)
1.761 -
1.762 -_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator>>(
1.763 - basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
1.764 -_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator<<(
1.765 - basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
1.766 -_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator>>(
1.767 - basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
1.768 -_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator<<(
1.769 - basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
1.770 -
1.771 -# ifndef _STLP_NO_LONG_DOUBLE
1.772 -_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator>>(
1.773 - basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
1.774 -_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL operator<<(
1.775 - basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
1.776 # endif
1.777
1.778 -# endif /* USE_TEMPLATE_EXPORT */
1.779 +# if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T)
1.780
1.781 -#else /* _STLP_USE_NEW_IOSTREAMS */
1.782 +_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
1.783 +operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<double>&);
1.784 +_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
1.785 +operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<double>&);
1.786 +_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
1.787 +operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<float>&);
1.788 +_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
1.789 +operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<float>&);
1.790
1.791 -template <class _Tp>
1.792 -ostream& _STLP_CALL operator<<(ostream& s, const complex<_Tp>& __z);
1.793 +# if !defined (_STLP_NO_LONG_DOUBLE)
1.794 +_STLP_EXPORT_TEMPLATE basic_istream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
1.795 +operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, complex<long double>&);
1.796 +_STLP_EXPORT_TEMPLATE basic_ostream<wchar_t, char_traits<wchar_t> >& _STLP_CALL
1.797 +operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
1.798 +# endif
1.799 +# endif
1.800 +#endif
1.801
1.802 -template <class _Tp>
1.803 -istream& _STLP_CALL operator>>(istream& s, complex<_Tp>& a);
1.804
1.805 -#endif /* _STLP_USE_NEW_IOSTREAMS */
1.806 -
1.807 -
1.808 -// Transcendental functions. These are defined only for float,
1.809 +// Transcendental functions. These are defined only for float,
1.810 // double, and long double. (Sqrt isn't transcendental, of course,
1.811 // but it's included in this section anyway.)
1.812
1.813 @@ -979,7 +927,7 @@
1.814 _STLP_DECLSPEC complex<double> _STLP_CALL cosh(const complex<double>&);
1.815 _STLP_DECLSPEC complex<double> _STLP_CALL tanh(const complex<double>&);
1.816
1.817 -# ifndef _STLP_NO_LONG_DOUBLE
1.818 +#if !defined (_STLP_NO_LONG_DOUBLE)
1.819 _STLP_DECLSPEC complex<long double> _STLP_CALL sqrt(const complex<long double>&);
1.820 _STLP_DECLSPEC complex<long double> _STLP_CALL exp(const complex<long double>&);
1.821 _STLP_DECLSPEC complex<long double> _STLP_CALL log(const complex<long double>&);
1.822 @@ -998,15 +946,15 @@
1.823 _STLP_DECLSPEC complex<long double> _STLP_CALL sinh(const complex<long double>&);
1.824 _STLP_DECLSPEC complex<long double> _STLP_CALL cosh(const complex<long double>&);
1.825 _STLP_DECLSPEC complex<long double> _STLP_CALL tanh(const complex<long double>&);
1.826 -# endif
1.827 +#endif
1.828
1.829 _STLP_END_NAMESPACE
1.830
1.831 -# ifndef _STLP_LINK_TIME_INSTANTIATION
1.832 +#ifndef _STLP_LINK_TIME_INSTANTIATION
1.833 # include <stl/_complex.c>
1.834 -# endif
1.835 +#endif
1.836
1.837 -#endif /* _STLP_template_complex */
1.838 +#endif
1.839
1.840 // Local Variables:
1.841 // mode:C++