complex: Trivial stylistic changes...
2008-05-25 Paolo Carlini <paolo.carlini@oracle.com> * include/std/complex: Trivial stylistic changes, define inline members inline, consistently with the rest of the library. (pow(const _Tp&, const complex<>&)): Minor tweak. From-SVN: r135872
This commit is contained in:
parent
3bffa1954c
commit
2acceeac67
@ -1,3 +1,9 @@
|
||||
2008-05-25 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* include/std/complex: Trivial stylistic changes, define inline
|
||||
members inline, consistently with the rest of the library.
|
||||
(pow(const _Tp&, const complex<>&)): Minor tweak.
|
||||
|
||||
2008-05-24 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* src/atomic.cc (atomic_flag_test_and_set_explicit,
|
||||
|
@ -121,29 +121,53 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
|
||||
/// Default constructor. First parameter is x, second parameter is y.
|
||||
/// Unspecified parameters default to 0.
|
||||
complex(const _Tp& = _Tp(), const _Tp & = _Tp());
|
||||
complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp())
|
||||
: _M_real(__r), _M_imag(__i) { }
|
||||
|
||||
// Lets the compiler synthesize the copy constructor
|
||||
// complex (const complex<_Tp>&);
|
||||
/// Copy constructor.
|
||||
template<typename _Up>
|
||||
complex(const complex<_Up>&);
|
||||
complex(const complex<_Up>& __z)
|
||||
: _M_real(__z.real()), _M_imag(__z.imag()) { }
|
||||
|
||||
/// Return real part of complex number.
|
||||
_Tp& real();
|
||||
_Tp& real()
|
||||
{ return _M_real; }
|
||||
|
||||
/// Return real part of complex number.
|
||||
const _Tp& real() const;
|
||||
const _Tp& real() const
|
||||
{ return _M_real; }
|
||||
|
||||
/// Return imaginary part of complex number.
|
||||
_Tp& imag();
|
||||
_Tp& imag()
|
||||
{ return _M_imag; }
|
||||
|
||||
/// Return imaginary part of complex number.
|
||||
const _Tp& imag() const;
|
||||
const _Tp& imag() const
|
||||
{ return _M_imag; }
|
||||
|
||||
/// Assign this complex number to scalar @a t.
|
||||
complex<_Tp>& operator=(const _Tp&);
|
||||
|
||||
/// Add @a t to this complex number.
|
||||
complex<_Tp>& operator+=(const _Tp&);
|
||||
// 26.2.5/1
|
||||
complex<_Tp>&
|
||||
operator+=(const _Tp& __t)
|
||||
{
|
||||
_M_real += __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Subtract @a t from this complex number.
|
||||
complex<_Tp>& operator-=(const _Tp&);
|
||||
// 26.2.5/3
|
||||
complex<_Tp>&
|
||||
operator-=(const _Tp& __t)
|
||||
{
|
||||
_M_real -= __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Multiply this complex number by @a t.
|
||||
complex<_Tp>& operator*=(const _Tp&);
|
||||
/// Divide this complex number by @a t.
|
||||
@ -168,40 +192,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
template<typename _Up>
|
||||
complex<_Tp>& operator/=(const complex<_Up>&);
|
||||
|
||||
const complex& __rep() const;
|
||||
const complex& __rep() const
|
||||
{ return *this; }
|
||||
|
||||
private:
|
||||
_Tp _M_real;
|
||||
_Tp _M_imag;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Tp&
|
||||
complex<_Tp>::real() { return _M_real; }
|
||||
|
||||
template<typename _Tp>
|
||||
inline const _Tp&
|
||||
complex<_Tp>::real() const { return _M_real; }
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Tp&
|
||||
complex<_Tp>::imag() { return _M_imag; }
|
||||
|
||||
template<typename _Tp>
|
||||
inline const _Tp&
|
||||
complex<_Tp>::imag() const { return _M_imag; }
|
||||
|
||||
template<typename _Tp>
|
||||
inline
|
||||
complex<_Tp>::complex(const _Tp& __r, const _Tp& __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()) { }
|
||||
|
||||
template<typename _Tp>
|
||||
complex<_Tp>&
|
||||
complex<_Tp>::operator=(const _Tp& __t)
|
||||
@ -211,24 +209,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/1
|
||||
template<typename _Tp>
|
||||
inline complex<_Tp>&
|
||||
complex<_Tp>::operator+=(const _Tp& __t)
|
||||
{
|
||||
_M_real += __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/3
|
||||
template<typename _Tp>
|
||||
inline complex<_Tp>&
|
||||
complex<_Tp>::operator-=(const _Tp& __t)
|
||||
{
|
||||
_M_real -= __t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// 26.2.5/5
|
||||
template<typename _Tp>
|
||||
complex<_Tp>&
|
||||
@ -308,10 +288,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline const complex<_Tp>&
|
||||
complex<_Tp>::__rep() const { return *this; }
|
||||
|
||||
// Operators:
|
||||
//@{
|
||||
/// Return new complex value @a x plus @a y.
|
||||
@ -995,7 +971,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
{
|
||||
return __x > _Tp() ? std::polar(pow(__x, __y.real()),
|
||||
__y.imag() * log(__x))
|
||||
: std::pow(complex<_Tp>(__x, _Tp()), __y);
|
||||
: std::pow(complex<_Tp>(__x), __y);
|
||||
}
|
||||
|
||||
// 26.2.3 complex specializations
|
||||
@ -1008,104 +984,70 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
|
||||
complex(_ComplexT __z) : _M_value(__z) { }
|
||||
|
||||
complex(float = 0.0f, float = 0.0f);
|
||||
|
||||
explicit complex(const complex<double>&);
|
||||
explicit complex(const complex<long double>&);
|
||||
|
||||
float& real();
|
||||
const float& real() const;
|
||||
float& imag();
|
||||
const float& imag() const;
|
||||
|
||||
complex<float>& operator=(float);
|
||||
complex<float>& operator+=(float);
|
||||
complex<float>& operator-=(float);
|
||||
complex<float>& operator*=(float);
|
||||
complex<float>& operator/=(float);
|
||||
|
||||
// Let the compiler synthesize the copy and assignment
|
||||
// operator. It always does a pretty good job.
|
||||
// complex& operator= (const complex&);
|
||||
template<typename _Tp>
|
||||
complex<float>&operator=(const complex<_Tp>&);
|
||||
template<typename _Tp>
|
||||
complex<float>& operator+=(const complex<_Tp>&);
|
||||
template<class _Tp>
|
||||
complex<float>& operator-=(const complex<_Tp>&);
|
||||
template<class _Tp>
|
||||
complex<float>& operator*=(const complex<_Tp>&);
|
||||
template<class _Tp>
|
||||
complex<float>&operator/=(const complex<_Tp>&);
|
||||
|
||||
const _ComplexT& __rep() const { return _M_value; }
|
||||
|
||||
private:
|
||||
_ComplexT _M_value;
|
||||
};
|
||||
|
||||
inline float&
|
||||
complex<float>::real()
|
||||
{ return __real__ _M_value; }
|
||||
|
||||
inline const float&
|
||||
complex<float>::real() const
|
||||
{ return __real__ _M_value; }
|
||||
|
||||
inline float&
|
||||
complex<float>::imag()
|
||||
{ return __imag__ _M_value; }
|
||||
|
||||
inline const float&
|
||||
complex<float>::imag() const
|
||||
{ return __imag__ _M_value; }
|
||||
|
||||
inline
|
||||
complex<float>::complex(float __r, float __i)
|
||||
complex(float __r = 0.0f, float __i = 0.0f)
|
||||
{
|
||||
__real__ _M_value = __r;
|
||||
__imag__ _M_value = __i;
|
||||
}
|
||||
|
||||
inline complex<float>&
|
||||
complex<float>::operator=(float __f)
|
||||
explicit complex(const complex<double>&);
|
||||
explicit complex(const complex<long double>&);
|
||||
|
||||
float& real()
|
||||
{ return __real__ _M_value; }
|
||||
|
||||
const float& real() const
|
||||
{ return __real__ _M_value; }
|
||||
|
||||
float& imag()
|
||||
{ return __imag__ _M_value; }
|
||||
|
||||
const float& imag() const
|
||||
{ return __imag__ _M_value; }
|
||||
|
||||
complex<float>&
|
||||
operator=(float __f)
|
||||
{
|
||||
__real__ _M_value = __f;
|
||||
__imag__ _M_value = 0.0f;
|
||||
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)
|
||||
{
|
||||
__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;
|
||||
}
|
||||
|
||||
// Let the compiler synthesize the copy and assignment
|
||||
// operator. It always does a pretty good job.
|
||||
// complex& operator=(const complex&);
|
||||
|
||||
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();
|
||||
@ -1113,26 +1055,26 @@ _GLIBCXX_BEGIN_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();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline complex<float>&
|
||||
complex<float>::operator-=(const complex<_Tp>& __z)
|
||||
template<class _Tp>
|
||||
complex<float>&
|
||||
operator-=(const complex<_Tp>& __z)
|
||||
{
|
||||
__real__ _M_value -= __z.real();
|
||||
__imag__ _M_value -= __z.imag();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline complex<float>&
|
||||
complex<float>::operator*=(const complex<_Tp>& __z)
|
||||
template<class _Tp>
|
||||
complex<float>&
|
||||
operator*=(const complex<_Tp>& __z)
|
||||
{
|
||||
_ComplexT __t;
|
||||
__real__ __t = __z.real();
|
||||
@ -1141,9 +1083,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline complex<float>&
|
||||
complex<float>::operator/=(const complex<_Tp>& __z)
|
||||
template<class _Tp>
|
||||
complex<float>&
|
||||
operator/=(const complex<_Tp>& __z)
|
||||
{
|
||||
_ComplexT __t;
|
||||
__real__ __t = __z.real();
|
||||
@ -1152,6 +1094,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
return *this;
|
||||
}
|
||||
|
||||
const _ComplexT& __rep() const { return _M_value; }
|
||||
|
||||
private:
|
||||
_ComplexT _M_value;
|
||||
};
|
||||
|
||||
// 26.2.3 complex specializations
|
||||
// complex<double> specialization
|
||||
template<>
|
||||
@ -1162,103 +1110,71 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
|
||||
complex(_ComplexT __z) : _M_value(__z) { }
|
||||
|
||||
complex(double = 0.0, double = 0.0);
|
||||
|
||||
complex(const complex<float>&);
|
||||
explicit complex(const complex<long double>&);
|
||||
|
||||
double& real();
|
||||
const double& real() const;
|
||||
double& imag();
|
||||
const double& imag() const;
|
||||
|
||||
complex<double>& operator=(double);
|
||||
complex<double>& operator+=(double);
|
||||
complex<double>& operator-=(double);
|
||||
complex<double>& operator*=(double);
|
||||
complex<double>& operator/=(double);
|
||||
|
||||
// The compiler will synthesize this, efficiently.
|
||||
// complex& operator= (const complex&);
|
||||
template<typename _Tp>
|
||||
complex<double>& operator=(const complex<_Tp>&);
|
||||
template<typename _Tp>
|
||||
complex<double>& operator+=(const complex<_Tp>&);
|
||||
template<typename _Tp>
|
||||
complex<double>& operator-=(const complex<_Tp>&);
|
||||
template<typename _Tp>
|
||||
complex<double>& operator*=(const complex<_Tp>&);
|
||||
template<typename _Tp>
|
||||
complex<double>& operator/=(const complex<_Tp>&);
|
||||
|
||||
const _ComplexT& __rep() const { return _M_value; }
|
||||
|
||||
private:
|
||||
_ComplexT _M_value;
|
||||
};
|
||||
|
||||
inline double&
|
||||
complex<double>::real()
|
||||
{ return __real__ _M_value; }
|
||||
|
||||
inline const double&
|
||||
complex<double>::real() const
|
||||
{ return __real__ _M_value; }
|
||||
|
||||
inline double&
|
||||
complex<double>::imag()
|
||||
{ return __imag__ _M_value; }
|
||||
|
||||
inline const double&
|
||||
complex<double>::imag() const
|
||||
{ return __imag__ _M_value; }
|
||||
|
||||
inline
|
||||
complex<double>::complex(double __r, double __i)
|
||||
complex(double __r = 0.0, double __i = 0.0)
|
||||
{
|
||||
__real__ _M_value = __r;
|
||||
__imag__ _M_value = __i;
|
||||
}
|
||||
|
||||
inline complex<double>&
|
||||
complex<double>::operator=(double __d)
|
||||
complex(const complex<float>& __z)
|
||||
: _M_value(__z.__rep()) { }
|
||||
|
||||
explicit complex(const complex<long double>&);
|
||||
|
||||
double& real()
|
||||
{ return __real__ _M_value; }
|
||||
|
||||
const double& real() const
|
||||
{ return __real__ _M_value; }
|
||||
|
||||
double& imag()
|
||||
{ return __imag__ _M_value; }
|
||||
|
||||
const double& imag() const
|
||||
{ return __imag__ _M_value; }
|
||||
|
||||
complex<double>&
|
||||
operator=(double __d)
|
||||
{
|
||||
__real__ _M_value = __d;
|
||||
__imag__ _M_value = 0.0;
|
||||
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)
|
||||
{
|
||||
__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;
|
||||
}
|
||||
|
||||
// The compiler will synthesize this, efficiently.
|
||||
// complex& operator=(const complex&);
|
||||
|
||||
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();
|
||||
@ -1266,8 +1182,8 @@ _GLIBCXX_BEGIN_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();
|
||||
@ -1275,8 +1191,8 @@ _GLIBCXX_BEGIN_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();
|
||||
@ -1284,8 +1200,8 @@ _GLIBCXX_BEGIN_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();
|
||||
@ -1295,8 +1211,8 @@ _GLIBCXX_BEGIN_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();
|
||||
@ -1305,6 +1221,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
return *this;
|
||||
}
|
||||
|
||||
const _ComplexT& __rep() const { return _M_value; }
|
||||
|
||||
private:
|
||||
_ComplexT _M_value;
|
||||
};
|
||||
|
||||
// 26.2.3 complex specializations
|
||||
// complex<long double> specialization
|
||||
template<>
|
||||
@ -1315,103 +1237,72 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
|
||||
complex(_ComplexT __z) : _M_value(__z) { }
|
||||
|
||||
complex(long double = 0.0L, long double = 0.0L);
|
||||
|
||||
complex(const complex<float>&);
|
||||
complex(const complex<double>&);
|
||||
|
||||
long double& real();
|
||||
const long double& real() const;
|
||||
long double& imag();
|
||||
const long double& imag() const;
|
||||
|
||||
complex<long double>& operator= (long double);
|
||||
complex<long double>& operator+= (long double);
|
||||
complex<long double>& operator-= (long double);
|
||||
complex<long double>& operator*= (long double);
|
||||
complex<long double>& operator/= (long double);
|
||||
|
||||
// The compiler knows how to do this efficiently
|
||||
// complex& operator= (const complex&);
|
||||
template<typename _Tp>
|
||||
complex<long double>& operator=(const complex<_Tp>&);
|
||||
template<typename _Tp>
|
||||
complex<long double>& operator+=(const complex<_Tp>&);
|
||||
template<typename _Tp>
|
||||
complex<long double>& operator-=(const complex<_Tp>&);
|
||||
template<typename _Tp>
|
||||
complex<long double>& operator*=(const complex<_Tp>&);
|
||||
template<typename _Tp>
|
||||
complex<long double>& operator/=(const complex<_Tp>&);
|
||||
|
||||
const _ComplexT& __rep() const { return _M_value; }
|
||||
|
||||
private:
|
||||
_ComplexT _M_value;
|
||||
};
|
||||
|
||||
inline
|
||||
complex<long double>::complex(long double __r, long double __i)
|
||||
complex(long double __r = 0.0L, long double __i = 0.0L)
|
||||
{
|
||||
__real__ _M_value = __r;
|
||||
__imag__ _M_value = __i;
|
||||
}
|
||||
|
||||
inline long double&
|
||||
complex<long double>::real()
|
||||
complex(const complex<float>& __z)
|
||||
: _M_value(__z.__rep()) { }
|
||||
|
||||
complex(const complex<double>& __z)
|
||||
: _M_value(__z.__rep()) { }
|
||||
|
||||
long double& real()
|
||||
{ return __real__ _M_value; }
|
||||
|
||||
inline const long double&
|
||||
complex<long double>::real() const
|
||||
const long double& real() const
|
||||
{ return __real__ _M_value; }
|
||||
|
||||
inline long double&
|
||||
complex<long double>::imag()
|
||||
long double& imag()
|
||||
{ return __imag__ _M_value; }
|
||||
|
||||
inline const long double&
|
||||
complex<long double>::imag() const
|
||||
const long double& imag() const
|
||||
{ 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;
|
||||
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)
|
||||
{
|
||||
_M_value *= __r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline complex<long double>&
|
||||
complex<long double>::operator/=(long double __r)
|
||||
complex<long double>&
|
||||
operator/=(long double __r)
|
||||
{
|
||||
_M_value /= __r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// The compiler knows how to do this efficiently
|
||||
// complex& operator=(const complex&);
|
||||
|
||||
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();
|
||||
@ -1419,8 +1310,8 @@ _GLIBCXX_BEGIN_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();
|
||||
@ -1428,8 +1319,8 @@ _GLIBCXX_BEGIN_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();
|
||||
@ -1437,8 +1328,8 @@ _GLIBCXX_BEGIN_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();
|
||||
@ -1448,8 +1339,8 @@ _GLIBCXX_BEGIN_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();
|
||||
@ -1458,6 +1349,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
return *this;
|
||||
}
|
||||
|
||||
const _ComplexT& __rep() const { return _M_value; }
|
||||
|
||||
private:
|
||||
_ComplexT _M_value;
|
||||
};
|
||||
|
||||
// These bits have to be at the end of this file, so that the
|
||||
// specializations have all been defined.
|
||||
// ??? No, they have to be there because of compiler limitation at
|
||||
@ -1470,22 +1367,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
complex<float>::complex(const complex<long double>& __z)
|
||||
: _M_value(__z.__rep()) { }
|
||||
|
||||
inline
|
||||
complex<double>::complex(const complex<float>& __z)
|
||||
: _M_value(__z.__rep()) { }
|
||||
|
||||
inline
|
||||
complex<double>::complex(const complex<long double>& __z)
|
||||
: _M_value(__z.__rep()) { }
|
||||
|
||||
inline
|
||||
complex<long double>::complex(const complex<float>& __z)
|
||||
: _M_value(__z.__rep()) { }
|
||||
|
||||
inline
|
||||
complex<long double>::complex(const complex<double>& __z)
|
||||
: _M_value(__z.__rep()) { }
|
||||
|
||||
// Inhibit implicit instantiations for required instantiations,
|
||||
// which are defined via explicit instantiations elsewhere.
|
||||
// NB: This syntax is a GNU extension.
|
||||
|
Loading…
Reference in New Issue
Block a user