[multiple changes]

2000-07-03  Benjamin Kosnik  <bkoz@purist.soma.redhat.com>

	* bits/std_memory.h: Revert.

2000-07-03  Brendan Kehoe  <brendan@zen.org>

	* bits/std_complex.h: Fix parens. Format.

From-SVN: r34857
This commit is contained in:
Benjamin Kosnik 2000-07-04 01:20:04 +00:00
parent 18fa319d7b
commit c14286b068
2 changed files with 642 additions and 639 deletions

View File

@ -1,3 +1,11 @@
2000-07-03 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
* bits/std_memory.h: Revert.
2000-07-03 Brendan Kehoe <brendan@zen.org>
* bits/std_complex.h: Fix parens. Format.
2000-07-01 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
Ulrich Drepper <drepper@purist.soma.redhat.com>

View File

@ -1,6 +1,6 @@
// The template and inlines for the -*- C++ -*- complex number classes.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -40,9 +40,9 @@
#include <bits/c++config.h>
#include <bits/std_iosfwd.h>
namespace std
{
// Forward declarations
template<typename _Tp> class complex;
template<> class complex<float>;
@ -82,37 +82,35 @@ namespace std
public:
typedef _Tp value_type;
complex (const _Tp& = _Tp(), const _Tp & = _Tp());
complex(const _Tp& = _Tp(), const _Tp & = _Tp());
// Let's the compiler synthetize the copy constructor
// complex (const complex<_Tp>&);
template <typename _Up>
complex (const complex<_Up>&);
complex(const complex<_Up>&);
_Tp real () const;
_Tp imag () const;
_Tp real() const;
_Tp imag() const;
complex<_Tp>& operator= (const _Tp&);
complex<_Tp>& operator+= (const _Tp&);
complex<_Tp>& operator-= (const _Tp&);
complex<_Tp>& operator*= (const _Tp&);
complex<_Tp>& operator/= (const _Tp&);
complex<_Tp>& operator=(const _Tp&);
complex<_Tp>& operator+=(const _Tp&);
complex<_Tp>& operator-=(const _Tp&);
complex<_Tp>& operator*=(const _Tp&);
complex<_Tp>& operator/=(const _Tp&);
// Let's the compiler synthetize the
// copy and assignment operator
// complex<_Tp>& operator= (const complex<_Tp>&);
template <typename _Up>
complex<_Tp>& operator= (const complex<_Up>&);
complex<_Tp>& operator=(const complex<_Up>&);
template <typename _Up>
complex<_Tp>& operator+= (const complex<_Up>&);
complex<_Tp>& operator+=(const complex<_Up>&);
template <typename _Up>
complex<_Tp>& operator-= (const complex<_Up>&);
complex<_Tp>& operator-=(const complex<_Up>&);
template <typename _Up>
complex<_Tp>& operator*= (const complex<_Up>&);
complex<_Tp>& operator*=(const complex<_Up>&);
template <typename _Up>
complex<_Tp>& operator/= (const complex<_Up>&);
complex<_Tp>& operator/=(const complex<_Up>&);
private:
_Tp _M_real, _M_imag;
@ -141,7 +139,7 @@ namespace std
complex(float = 0.0f, float = 0.0f);
#ifdef _GLIBCPP_BUGGY_COMPLEX
complex(const complex& __z) : _M_value(__z._M_value) {}
complex(const complex& __z) : _M_value(__z._M_value) { }
#endif
explicit complex(const complex<double>&);
explicit complex(const complex<long double>&);
@ -149,32 +147,31 @@ namespace std
float real() const;
float imag() const;
complex<float>& operator= (float);
complex<float>& operator+= (float);
complex<float>& operator-= (float);
complex<float>& operator*= (float);
complex<float>& operator/= (float);
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>&);
complex<float>&operator=(const complex<_Tp>&);
template <typename _Tp>
complex<float>& operator+= (const complex<_Tp>&);
complex<float>& operator+=(const complex<_Tp>&);
template <class _Tp>
complex<float>& operator-= (const complex<_Tp>&);
complex<float>& operator-=(const complex<_Tp>&);
template <class _Tp>
complex<float>& operator*= (const complex<_Tp>&);
complex<float>& operator*=(const complex<_Tp>&);
template <class _Tp>
complex<float>&operator/= (const complex<_Tp>&);
complex<float>&operator/=(const complex<_Tp>&);
private:
typedef __complex__ float _ComplexT;
_ComplexT _M_value;
complex(_ComplexT __z) : _M_value(__z) {}
complex(_ComplexT __z) : _M_value(__z) { }
friend class complex<double>;
friend class complex<long double>;
@ -220,39 +217,38 @@ namespace std
complex(double =0.0, double =0.0);
#ifdef _GLIBCPP_BUGGY_COMPLEX
complex(const complex& __z) : _M_value(__z._M_value) {}
complex(const complex& __z) : _M_value(__z._M_value) { }
#endif
complex(const complex<float>&);
explicit complex(const complex<long double>&);
double real () const;
double imag () const;
double real() const;
double imag() const;
complex<double>& operator= (double);
complex<double>& operator+= (double);
complex<double>& operator-= (double);
complex<double>& operator*= (double);
complex<double>& operator/= (double);
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>&);
complex<double>& operator=(const complex<_Tp>&);
template <typename _Tp>
complex<double>& operator+= (const complex<_Tp>&);
complex<double>& operator+=(const complex<_Tp>&);
template <typename _Tp>
complex<double>& operator-= (const complex<_Tp>&);
complex<double>& operator-=(const complex<_Tp>&);
template <typename _Tp>
complex<double>& operator*= (const complex<_Tp>&);
complex<double>& operator*=(const complex<_Tp>&);
template <typename _Tp>
complex<double>& operator/= (const complex<_Tp>&);
complex<double>& operator/=(const complex<_Tp>&);
private:
typedef __complex__ double _ComplexT;
_ComplexT _M_value;
complex(_ComplexT __z) : _M_value(__z) {}
complex(_ComplexT __z) : _M_value(__z) { }
friend class complex<float>;
friend class complex<long double>;
@ -261,7 +257,6 @@ namespace std
friend double arg<>(const complex<double>&);
friend complex<double> conj<>(const complex<double>&);
friend complex<double> cos<>(const complex<double>&);
friend complex<double> cosh<>(const complex<double>&);
friend complex<double> exp<>(const complex<double>&);
@ -298,7 +293,7 @@ namespace std
complex(long double = 0.0L, long double = 0.0L);
#ifdef _GLIBCPP_BUGGY_COMPLEX
complex(const complex& __z) : _M_value(__z._M_value) {}
complex(const complex& __z) : _M_value(__z._M_value) { }
#endif
complex(const complex<float>&);
complex(const complex<double>&);
@ -316,21 +311,21 @@ namespace std
// complex& operator= (const complex&);
template<typename _Tp>
complex<long double>& operator= (const complex<_Tp>&);
complex<long double>& operator=(const complex<_Tp>&);
template<typename _Tp>
complex<long double>& operator+= (const complex<_Tp>&);
complex<long double>& operator+=(const complex<_Tp>&);
template<typename _Tp>
complex<long double>& operator-= (const complex<_Tp>&);
complex<long double>& operator-=(const complex<_Tp>&);
template<typename _Tp>
complex<long double>& operator*= (const complex<_Tp>&);
complex<long double>& operator*=(const complex<_Tp>&);
template<typename _Tp>
complex<long double>& operator/= (const complex<_Tp>&);
complex<long double>& operator/=(const complex<_Tp>&);
private:
typedef __complex__ long double _ComplexT;
_ComplexT _M_value;
complex(_ComplexT __z) : _M_value(__z) {}
complex(_ComplexT __z) : _M_value(__z) { }
friend class complex<float>;
friend class complex<double>;
@ -339,7 +334,6 @@ namespace std
friend long double arg<>(const complex<long double>&);
friend complex<long double> conj<>(const complex<long double>&);
friend complex<long double> cos<>(const complex<long double>&);
friend complex<long double> cosh<>(const complex<long double>&);
friend complex<long double> exp<>(const complex<long double>&);
@ -368,11 +362,11 @@ namespace std
inline
complex<long double>::complex(const complex<float>& __z)
: _M_value(_ComplexT(__z._M_value)) {}
: _M_value(_ComplexT(__z._M_value)) { }
inline
complex<long double>::complex(const complex<double>& __z)
: _M_value(_ComplexT(__z._M_value)) {}
: _M_value(_ComplexT(__z._M_value)) { }
inline long double
complex<long double>::real() const
@ -383,7 +377,7 @@ namespace std
{ return __imag__ _M_value; }
inline complex<long double>&
complex<long double>::operator= (long double __r)
complex<long double>::operator=(long double __r)
{
__real__ _M_value = __r;
__imag__ _M_value = 0.0L;
@ -391,28 +385,28 @@ namespace std
}
inline complex<long double>&
complex<long double>::operator+= (long double __r)
complex<long double>::operator+=(long double __r)
{
__real__ _M_value += __r;
return *this;
}
inline complex<long double>&
complex<long double>::operator-= (long double __r)
complex<long double>::operator-=(long double __r)
{
__real__ _M_value -= __r;
return *this;
}
inline complex<long double>&
complex<long double>::operator*= (long double __r)
complex<long double>::operator*=(long double __r)
{
__real__ _M_value *= __r;
return *this;
}
inline complex<long double>&
complex<long double>::operator/= (long double __r)
complex<long double>::operator/=(long double __r)
{
__real__ _M_value /= __r;
return *this;
@ -420,7 +414,7 @@ namespace std
template<typename _Tp>
inline complex<long double>&
complex<long double>::operator= (const complex<_Tp>& __z)
complex<long double>::operator=(const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
@ -429,7 +423,7 @@ namespace std
template<typename _Tp>
inline complex<long double>&
complex<long double>::operator+= (const complex<_Tp>& __z)
complex<long double>::operator+=(const complex<_Tp>& __z)
{
__real__ _M_value += __z.real();
__imag__ _M_value += __z.imag();
@ -438,7 +432,7 @@ namespace std
template<typename _Tp>
inline complex<long double>&
complex<long double>::operator-= (const complex<_Tp>& __z)
complex<long double>::operator-=(const complex<_Tp>& __z)
{
__real__ _M_value -= __z.real();
__imag__ _M_value -= __z.imag();
@ -447,7 +441,7 @@ namespace std
template<typename _Tp>
inline complex<long double>&
complex<long double>::operator*= (const complex<_Tp>& __z)
complex<long double>::operator*=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
@ -458,7 +452,7 @@ namespace std
template<typename _Tp>
inline complex<long double>&
complex<long double>::operator/= (const complex<_Tp>& __z)
complex<long double>::operator/=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
@ -479,14 +473,14 @@ namespace std
inline
complex<float>::complex(const complex<double>& __z)
: _M_value(_ComplexT(__z._M_value)) {}
: _M_value(_ComplexT(__z._M_value)) { }
inline
complex<float>::complex(const complex<long double>& __z)
: _M_value(_ComplexT(__z._M_value)) {}
: _M_value(_ComplexT(__z._M_value)) { }
inline complex<float>&
complex<float>::operator= (float __f)
complex<float>::operator=(float __f)
{
__real__ _M_value = __f;
__imag__ _M_value = 0.0f;
@ -494,28 +488,28 @@ namespace std
}
inline complex<float>&
complex<float>::operator+= (float __f)
complex<float>::operator+=(float __f)
{
__real__ _M_value += __f;
return *this;
}
inline complex<float>&
complex<float>::operator-= (float __f)
complex<float>::operator-=(float __f)
{
__real__ _M_value -= __f;
return *this;
}
inline complex<float>&
complex<float>::operator*= (float __f)
complex<float>::operator*=(float __f)
{
_M_value *= __f;
return *this;
}
inline complex<float>&
complex<float>::operator/= (float __f)
complex<float>::operator/=(float __f)
{
_M_value /= __f;
return *this;
@ -523,7 +517,7 @@ namespace std
template<typename _Tp>
inline complex<float>&
complex<float>::operator= (const complex<_Tp>& __z)
complex<float>::operator=(const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
@ -532,7 +526,7 @@ namespace std
template<typename _Tp>
inline complex<float>&
complex<float>::operator+= (const complex<_Tp>& __z)
complex<float>::operator+=(const complex<_Tp>& __z)
{
__real__ _M_value += __z.real();
__imag__ _M_value += __z.imag();
@ -541,7 +535,7 @@ namespace std
template<typename _Tp>
inline complex<float>&
complex<float>::operator-= (const complex<_Tp>& __z)
complex<float>::operator-=(const complex<_Tp>& __z)
{
__real__ _M_value -= __z.real();
__imag__ _M_value -= __z.real();
@ -550,7 +544,7 @@ namespace std
template<typename _Tp>
inline complex<float>&
complex<float>::operator*= (const complex<_Tp>& __z)
complex<float>::operator*=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
@ -561,7 +555,7 @@ namespace std
template<typename _Tp>
inline complex<float>&
complex<float>::operator/= (const complex<_Tp>& __z)
complex<float>::operator/=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
@ -583,7 +577,7 @@ namespace std
inline
complex<double>::complex(const complex<float>& __z)
: _M_value(_ComplexT(__z._M_value)) {}
: _M_value(_ComplexT(__z._M_value)) { }
inline
complex<double>::complex(const complex<long double>& __z)
@ -593,7 +587,7 @@ namespace std
}
inline complex<double>&
complex<double>::operator= (double __d)
complex<double>::operator=(double __d)
{
__real__ _M_value = __d;
__imag__ _M_value = 0.0;
@ -601,28 +595,28 @@ namespace std
}
inline complex<double>&
complex<double>::operator+= (double __d)
complex<double>::operator+=(double __d)
{
__real__ _M_value += __d;
return *this;
}
inline complex<double>&
complex<double>::operator-= (double __d)
complex<double>::operator-=(double __d)
{
__real__ _M_value -= __d;
return *this;
}
inline complex<double>&
complex<double>::operator*= (double __d)
complex<double>::operator*=(double __d)
{
_M_value *= __d;
return *this;
}
inline complex<double>&
complex<double>::operator/= (double __d)
complex<double>::operator/=(double __d)
{
_M_value /= __d;
return *this;
@ -630,7 +624,7 @@ namespace std
template<typename _Tp>
inline complex<double>&
complex<double>::operator= (const complex<_Tp>& __z)
complex<double>::operator=(const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
@ -639,7 +633,7 @@ namespace std
template<typename _Tp>
inline complex<double>&
complex<double>::operator+= (const complex<_Tp>& __z)
complex<double>::operator+=(const complex<_Tp>& __z)
{
__real__ _M_value += __z.real();
__imag__ _M_value += __z.imag();
@ -648,7 +642,7 @@ namespace std
template<typename _Tp>
inline complex<double>&
complex<double>::operator-= (const complex<_Tp>& __z)
complex<double>::operator-=(const complex<_Tp>& __z)
{
__real__ _M_value -= __z.real();
__imag__ _M_value -= __z.imag();
@ -657,7 +651,7 @@ namespace std
template<typename _Tp>
inline complex<double>&
complex<double>::operator*= (const complex<_Tp>& __z)
complex<double>::operator*=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
@ -668,7 +662,7 @@ namespace std
template<typename _Tp>
inline complex<double>&
complex<double>::operator/= (const complex<_Tp>& __z)
complex<double>::operator/=(const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
@ -684,13 +678,13 @@ namespace std
template<typename _Tp>
inline
complex<_Tp>::complex(const _Tp& __r, const _Tp& __i)
: _M_real(__r), _M_imag(__i) {}
: _M_real(__r), _M_imag(__i) { }
template<typename _Tp>
template<typename _Up>
inline
complex<_Tp>::complex(const complex<_Up>& __z)
: _M_real(__z.real()), _M_imag(__z.imag()) {}
: _M_real(__z.real()), _M_imag(__z.imag()) { }
// 26.2.7/6
template<typename _Tp>
@ -709,7 +703,7 @@ namespace std
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator= (const _Tp& __t)
complex<_Tp>::operator=(const _Tp& __t)
{
_M_real = __t;
_M_imag = _Tp();
@ -719,7 +713,7 @@ namespace std
// 26.2.5/1
template<typename _Tp>
inline complex<_Tp>&
complex<_Tp>::operator+= (const _Tp& __t)
complex<_Tp>::operator+=(const _Tp& __t)
{
_M_real += __t;
return *this;
@ -728,7 +722,7 @@ namespace std
// 26.2.5/3
template<typename _Tp>
inline complex<_Tp>&
complex<_Tp>::operator-= (const _Tp& __t)
complex<_Tp>::operator-=(const _Tp& __t)
{
_M_real -= __t;
return *this;
@ -737,7 +731,7 @@ namespace std
// 26.2.5/5
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator*= (const _Tp& __t)
complex<_Tp>::operator*=(const _Tp& __t)
{
_M_real *= __t;
_M_imag *= __t;
@ -747,7 +741,7 @@ namespace std
// 26.2.5/7
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator/= (const _Tp& __t)
complex<_Tp>::operator/=(const _Tp& __t)
{
_M_real /= __t;
_M_imag /= __t;
@ -757,7 +751,7 @@ namespace std
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator= (const complex<_Up>& __z)
complex<_Tp>::operator=(const complex<_Up>& __z)
{
_M_real = __z.real();
_M_imag = __z.imag();
@ -768,7 +762,7 @@ namespace std
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator+= (const complex<_Up>& __z)
complex<_Tp>::operator+=(const complex<_Up>& __z)
{
_M_real += __z.real();
_M_imag += __z.imag();
@ -779,7 +773,7 @@ namespace std
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator-= (const complex<_Up>& __z)
complex<_Tp>::operator-=(const complex<_Up>& __z)
{
_M_real -= __z.real();
_M_imag -= __z.imag();
@ -791,7 +785,7 @@ namespace std
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator*= (const complex<_Up>& __z)
complex<_Tp>::operator*=(const complex<_Up>& __z)
{
_Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
_M_imag = _M_real * __z.imag() + _M_imag * __z.real();
@ -804,7 +798,7 @@ namespace std
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator/= (const complex<_Up>& __z)
complex<_Tp>::operator/=(const complex<_Up>& __z)
{
_Tp __r = _M_real * __z.real() + _M_imag * __z.imag();
_Tp __n = norm(__z);
@ -813,7 +807,6 @@ namespace std
return *this;
}
// Operators:
template<typename _Tp>
inline complex<_Tp>
@ -888,7 +881,7 @@ namespace std
template<typename _Tp>
inline bool
operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return __x.real() == __y.real() && __x.imag == __y.imag(); }
{ return __x.real() == __y.real() && __x.imag() == __y.imag(); }
template<typename _Tp>
inline bool
@ -927,12 +920,12 @@ namespace std
// Values:
template <typename _Tp>
inline _Tp
real (const complex<_Tp>& __z)
real(const complex<_Tp>& __z)
{ return __z.real(); }
template <typename _Tp>
inline _Tp
imag (const complex<_Tp>& __z)
imag(const complex<_Tp>& __z)
{ return __z.imag(); }
@ -957,10 +950,12 @@ namespace std
template<>
inline complex<long double>
conj(const complex<long double> &__x)
{
return complex<long double> (~__x._M_value);
}
{ return complex<long double> (~__x._M_value); }
} // namespace std
#endif /* _CPP_COMPLEX */