From: Paolo Carlini Date: Sat, 5 Jul 2003 20:44:17 +0000 (+0200) Subject: std_complex.h: Fully qualify standard functions with std::, thus avoiding Koenig... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eb9a42315387b85e16a9462101f8febe5d2b112f;p=gcc.git std_complex.h: Fully qualify standard functions with std::, thus avoiding Koenig lookup. 2003-07-05 Paolo Carlini * include/std/std_complex.h: Fully qualify standard functions with std::, thus avoiding Koenig lookup. * include/std/std_memory.h: Likewise. * include/std/std_valarray.h: Likewise. From-SVN: r68982 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4ab9076ac77..c55d7840101 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2003-07-05 Paolo Carlini + + * include/std/std_complex.h: Fully qualify standard + functions with std::, thus avoiding Koenig lookup. + * include/std/std_memory.h: Likewise. + * include/std/std_valarray.h: Likewise. + 2003-07-05 Gawain Bolton * include/bits/stl_tree.h: _Rb_tree_rebalance(): Add local diff --git a/libstdc++-v3/include/std/std_complex.h b/libstdc++-v3/include/std/std_complex.h index 97d764df96b..fe7dd22f008 100644 --- a/libstdc++-v3/include/std/std_complex.h +++ b/libstdc++-v3/include/std/std_complex.h @@ -243,7 +243,7 @@ namespace std complex<_Tp>::operator/=(const complex<_Up>& __z) { const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag(); - const _Tp __n = norm(__z); + const _Tp __n = std::norm(__z); _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n; _M_real = __r / __n; return *this; @@ -411,18 +411,18 @@ namespace std { _Tp __x = __z.real(); _Tp __y = __z.imag(); - const _Tp __s = std::max(abs(__x), abs(__y)); + const _Tp __s = std::max(std::abs(__x), std::abs(__y)); if (__s == _Tp()) // well ... return __s; __x /= __s; __y /= __s; - return __s * sqrt(__x * __x + __y * __y); + return __s * std::sqrt(__x * __x + __y * __y); } template inline _Tp arg(const complex<_Tp>& __z) - { return atan2(__z.imag(), __z.real()); } + { return std::atan2(__z.imag(), __z.real()); } // 26.2.7/5: norm(__z) returns the squared magintude of __z. // As defined, norm() is -not- a norm is the common mathematical @@ -447,7 +447,7 @@ namespace std template static inline _Tp _S_do_it(const complex<_Tp>& __z) { - _Tp __res = abs(__z); + _Tp __res = std::abs(__z); return __res * __res; } }; @@ -462,7 +462,7 @@ namespace std template inline complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta) - { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); } + { return complex<_Tp>(__rho * std::cos(__theta), __rho * std::sin(__theta)); } template inline complex<_Tp> @@ -476,7 +476,7 @@ namespace std { const _Tp __x = __z.real(); const _Tp __y = __z.imag(); - return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y)); + return complex<_Tp>(std::cos(__x) * std::cosh(__y), -std::sin(__x) * std::sinh(__y)); } template @@ -485,23 +485,23 @@ namespace std { const _Tp __x = __z.real(); const _Tp __y = __z.imag(); - return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y)); + return complex<_Tp>(std::cosh(__x) * std::cos(__y), std::sinh(__x) * std::sin(__y)); } template inline complex<_Tp> exp(const complex<_Tp>& __z) - { return polar(exp(__z.real()), __z.imag()); } + { return std::polar(std::exp(__z.real()), __z.imag()); } template inline complex<_Tp> log(const complex<_Tp>& __z) - { return complex<_Tp>(log(abs(__z)), arg(__z)); } + { return complex<_Tp>(std::log(std::abs(__z)), std::arg(__z)); } template inline complex<_Tp> log10(const complex<_Tp>& __z) - { return log(__z) / log(_Tp(10.0)); } + { return std::log(__z) / std::log(_Tp(10.0)); } template inline complex<_Tp> @@ -509,7 +509,7 @@ namespace std { const _Tp __x = __z.real(); const _Tp __y = __z.imag(); - return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y)); + return complex<_Tp>(std::sin(__x) * std::cosh(__y), std::cos(__x) * std::sinh(__y)); } template @@ -518,7 +518,7 @@ namespace std { const _Tp __x = __z.real(); const _Tp __y = __z.imag(); - return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y)); + return complex<_Tp>(std::sinh(__x) * std::cos(__y), std::cosh(__x) * std::sin(__y)); } template @@ -530,16 +530,16 @@ namespace std if (__x == _Tp()) { - _Tp __t = sqrt(abs(__y) / 2); + _Tp __t = std::sqrt(std::abs(__y) / 2); return complex<_Tp>(__t, __y < _Tp() ? -__t : __t); } else { - _Tp __t = sqrt(2 * (abs(__z) + abs(__x))); + _Tp __t = std::sqrt(2 * (std::abs(__z) + std::abs(__x))); _Tp __u = __t / 2; return __x > _Tp() ? complex<_Tp>(__u, __y / __t) - : complex<_Tp>(abs(__y) / __t, __y < _Tp() ? -__u : __u); + : complex<_Tp>(std::abs(__y) / __t, __y < _Tp() ? -__u : __u); } } @@ -547,21 +547,21 @@ namespace std inline complex<_Tp> tan(const complex<_Tp>& __z) { - return sin(__z) / cos(__z); + return std::sin(__z) / std::cos(__z); } template inline complex<_Tp> tanh(const complex<_Tp>& __z) { - return sinh(__z) / cosh(__z); + return std::sinh(__z) / std::cosh(__z); } template inline complex<_Tp> pow(const complex<_Tp>& __z, int __n) { - return __pow_helper(__z, __n); + return std::__pow_helper(__z, __n); } template @@ -569,17 +569,17 @@ namespace std pow(const complex<_Tp>& __x, const _Tp& __y) { if (__x.imag() == _Tp()) - return pow(__x.real(), __y); + return std::pow(__x.real(), __y); - complex<_Tp> __t = log(__x); - return polar(exp(__y * __t.real()), __y * __t.imag()); + complex<_Tp> __t = std::log(__x); + return std::polar(std::exp(__y * __t.real()), __y * __t.imag()); } template inline complex<_Tp> pow(const complex<_Tp>& __x, const complex<_Tp>& __y) { - return __x == _Tp() ? _Tp() : exp(__y * log(__x)); + return __x == _Tp() ? _Tp() : std::exp(__y * std::log(__x)); } template @@ -588,7 +588,7 @@ namespace std { return __x == _Tp() ? _Tp() - : polar(pow(__x, __y.real()), __y.imag() * log(__x)); + : std::polar(std::pow(__x, __y.real()), __y.imag() * std::log(__x)); } // 26.2.3 complex specializations diff --git a/libstdc++-v3/include/std/std_memory.h b/libstdc++-v3/include/std/std_memory.h index 49cf008cf88..68076897ec6 100644 --- a/libstdc++-v3/include/std/std_memory.h +++ b/libstdc++-v3/include/std/std_memory.h @@ -103,7 +103,7 @@ namespace std template inline pair<_Tp*,ptrdiff_t> get_temporary_buffer(ptrdiff_t __len) - { return __get_temporary_buffer(__len, (_Tp*) 0); } + { return std::__get_temporary_buffer(__len, (_Tp*) 0); } /** * @brief The companion to get_temporary_buffer(). diff --git a/libstdc++-v3/include/std/std_valarray.h b/libstdc++-v3/include/std/std_valarray.h index d5bdd557483..4656dc3b753 100644 --- a/libstdc++-v3/include/std/std_valarray.h +++ b/libstdc++-v3/include/std/std_valarray.h @@ -248,32 +248,32 @@ namespace std inline valarray<_Tp>::valarray(size_t __n) : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) - { __valarray_default_construct(_M_data, _M_data + __n); } + { std::__valarray_default_construct(_M_data, _M_data + __n); } template inline valarray<_Tp>::valarray(const _Tp& __t, size_t __n) : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) - { __valarray_fill_construct(_M_data, _M_data + __n, __t); } + { std::__valarray_fill_construct(_M_data, _M_data + __n, __t); } template inline valarray<_Tp>::valarray(const _Tp* __restrict__ __p, size_t __n) : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) - { __valarray_copy_construct(__p, __p + __n, _M_data); } + { std::__valarray_copy_construct(__p, __p + __n, _M_data); } template inline valarray<_Tp>::valarray(const valarray<_Tp>& __v) : _M_size(__v._M_size), _M_data(__valarray_get_storage<_Tp>(__v._M_size)) - { __valarray_copy_construct(__v._M_data, __v._M_data + _M_size, _M_data); } + { std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size, _M_data); } template inline valarray<_Tp>::valarray(const slice_array<_Tp>& __sa) : _M_size(__sa._M_sz), _M_data(__valarray_get_storage<_Tp>(__sa._M_sz)) { - __valarray_copy + std::__valarray_copy (__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data)); } @@ -283,7 +283,7 @@ namespace std : _M_size(__ga._M_index.size()), _M_data(__valarray_get_storage<_Tp>(_M_size)) { - __valarray_copy + std::__valarray_copy (__ga._M_array, _Array(__ga._M_index), _Array<_Tp>(_M_data), _M_size); } @@ -293,7 +293,7 @@ namespace std valarray<_Tp>::valarray(const mask_array<_Tp>& __ma) : _M_size(__ma._M_sz), _M_data(__valarray_get_storage<_Tp>(__ma._M_sz)) { - __valarray_copy + std::__valarray_copy (__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size); } @@ -302,7 +302,7 @@ namespace std valarray<_Tp>::valarray(const indirect_array<_Tp>& __ia) : _M_size(__ia._M_sz), _M_data(__valarray_get_storage<_Tp>(__ia._M_sz)) { - __valarray_copy + std::__valarray_copy (__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size); } @@ -310,21 +310,21 @@ namespace std inline valarray<_Tp>::valarray(const _Expr<_Dom, _Tp>& __e) : _M_size(__e.size()), _M_data(__valarray_get_storage<_Tp>(_M_size)) - { __valarray_copy(__e, _M_size, _Array<_Tp>(_M_data)); } + { std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data)); } template inline valarray<_Tp>::~valarray() { - __valarray_destroy_elements(_M_data, _M_data + _M_size); - __valarray_release_memory(_M_data); + std::__valarray_destroy_elements(_M_data, _M_data + _M_size); + std::__valarray_release_memory(_M_data); } template inline valarray<_Tp>& valarray<_Tp>::operator=(const valarray<_Tp>& __v) { - __valarray_copy(__v._M_data, _M_size, _M_data); + std::__valarray_copy(__v._M_data, _M_size, _M_data); return *this; } @@ -332,7 +332,7 @@ namespace std inline valarray<_Tp>& valarray<_Tp>::operator=(const _Tp& __t) { - __valarray_fill(_M_data, _M_size, __t); + std::__valarray_fill(_M_data, _M_size, __t); return *this; } @@ -340,8 +340,8 @@ namespace std inline valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __sa) { - __valarray_copy(__sa._M_array, __sa._M_sz, - __sa._M_stride, _Array<_Tp>(_M_data)); + std::__valarray_copy(__sa._M_array, __sa._M_sz, + __sa._M_stride, _Array<_Tp>(_M_data)); return *this; } @@ -349,8 +349,8 @@ namespace std inline valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __ga) { - __valarray_copy(__ga._M_array, _Array(__ga._M_index), - _Array<_Tp>(_M_data), _M_size); + std::__valarray_copy(__ga._M_array, _Array(__ga._M_index), + _Array<_Tp>(_M_data), _M_size); return *this; } @@ -358,8 +358,8 @@ namespace std inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __ma) { - __valarray_copy(__ma._M_array, __ma._M_mask, - _Array<_Tp>(_M_data), _M_size); + std::__valarray_copy(__ma._M_array, __ma._M_mask, + _Array<_Tp>(_M_data), _M_size); return *this; } @@ -367,8 +367,8 @@ namespace std inline valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __ia) { - __valarray_copy(__ia._M_array, __ia._M_index, - _Array<_Tp>(_M_data), _M_size); + std::__valarray_copy(__ia._M_array, __ia._M_index, + _Array<_Tp>(_M_data), _M_size); return *this; } @@ -376,8 +376,8 @@ namespace std inline valarray<_Tp>& valarray<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) { - __valarray_copy(__e, _M_size, _Array<_Tp>(_M_data)); - return *this; + std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data)); + return *this; } template @@ -460,7 +460,7 @@ namespace std inline _Tp valarray<_Tp>::sum() const { - return __valarray_sum(_M_data, _M_data + _M_size); + return std::__valarray_sum(_M_data, _M_data + _M_size); } // template @@ -477,21 +477,21 @@ namespace std _Tp* const __a = static_cast<_Tp*> (__builtin_alloca(sizeof(_Tp) * _M_size)); if (__n == 0) // no shift - __valarray_copy_construct(_M_data, _M_data + _M_size, __a); + std::__valarray_copy_construct(_M_data, _M_data + _M_size, __a); else if (__n > 0) // __n > 0: shift left { if (size_t(__n) > _M_size) - __valarray_default_construct(__a, __a + __n); + std::__valarray_default_construct(__a, __a + __n); else { - __valarray_copy_construct(_M_data+__n, _M_data + _M_size, __a); - __valarray_default_construct(__a+_M_size-__n, __a + _M_size); + std::__valarray_copy_construct(_M_data+__n, _M_data + _M_size, __a); + std::__valarray_default_construct(__a+_M_size-__n, __a + _M_size); } } else // __n < 0: shift right { - __valarray_copy_construct (_M_data, _M_data+_M_size+__n, __a-__n); - __valarray_default_construct(__a, __a - __n); + std::__valarray_copy_construct (_M_data, _M_data+_M_size+__n, __a-__n); + std::__valarray_default_construct(__a, __a - __n); } return valarray<_Tp> (__a, _M_size); } @@ -503,17 +503,17 @@ namespace std _Tp* const __a = static_cast<_Tp*> (__builtin_alloca (sizeof(_Tp) * _M_size)); if (__n == 0) // no cshift - __valarray_copy_construct(_M_data, _M_data + _M_size, __a); + std::__valarray_copy_construct(_M_data, _M_data + _M_size, __a); else if (__n > 0) // cshift left { - __valarray_copy_construct(_M_data, _M_data+__n, __a+_M_size-__n); - __valarray_copy_construct(_M_data+__n, _M_data + _M_size, __a); + std::__valarray_copy_construct(_M_data, _M_data+__n, __a+_M_size-__n); + std::__valarray_copy_construct(_M_data+__n, _M_data + _M_size, __a); } else // cshift right { - __valarray_copy_construct + std::__valarray_copy_construct (_M_data + _M_size+__n, _M_data + _M_size, __a); - __valarray_copy_construct + std::__valarray_copy_construct (_M_data, _M_data + _M_size+__n, __a - __n); } return valarray<_Tp>(__a, _M_size); @@ -526,28 +526,28 @@ namespace std // This complication is so to make valarray > work // even though it is not required by the standard. Nobody should // be saying valarray > anyway. See the specs. - __valarray_destroy_elements(_M_data, _M_data + _M_size); + std::__valarray_destroy_elements(_M_data, _M_data + _M_size); if (_M_size != __n) { - __valarray_release_memory(_M_data); + std::__valarray_release_memory(_M_data); _M_size = __n; _M_data = __valarray_get_storage<_Tp>(__n); } - __valarray_fill_construct(_M_data, _M_data + __n, __c); + std::__valarray_fill_construct(_M_data, _M_data + __n, __c); } template inline _Tp valarray<_Tp>::min() const { - return *min_element (_M_data, _M_data+_M_size); + return *std::min_element (_M_data, _M_data+_M_size); } template inline _Tp valarray<_Tp>::max() const { - return *max_element (_M_data, _M_data+_M_size); + return *std::max_element (_M_data, _M_data+_M_size); } template