From 59fa40034ee1eedee3f11a02495ac24e4a6b2053 Mon Sep 17 00:00:00 2001 From: paolo Date: Thu, 16 Sep 2010 12:39:13 +0000 Subject: [PATCH] 2010-09-16 Paolo Carlini * include/std/complex (complex::operator=(float), complex::operator+=(float), complex::operator-=(float), complex::operator=(double), complex::operator+=(double), complex::operator-=(double), complex::operator=(long double), complex::operator+=(long double), complex::operator-=(long double)): Simplify a tad, just forward to the underlying __complex__ T operators, as operator*= and operator/= already do. * include/std/complex (complex, complex, complex): Simplify spelling of return types, just say complex, instead of complex, complex, complex, respectively. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164337 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 19 ++++++++++ libstdc++-v3/include/std/complex | 81 +++++++++++++++++++--------------------- 2 files changed, 58 insertions(+), 42 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4ef9a22..983a1e9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,22 @@ +2010-09-16 Paolo Carlini + + * include/std/complex (complex::operator=(float), + complex::operator+=(float), + complex::operator-=(float), + complex::operator=(double), + complex::operator+=(double), + complex::operator-=(double), + complex::operator=(long double), + complex::operator+=(long double), + complex::operator-=(long double)): Simplify a tad, + just forward to the underlying __complex__ T operators, as + operator*= and operator/= already do. + + * include/std/complex (complex, complex, + complex): Simplify spelling of return types, just + say complex, instead of complex, complex, + complex, respectively. + 2010-09-15 François Dumont * testsuite/lib/libstdc++.exp,([check_v3_target_namedlocale]): diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 6d3097e..31c4436 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -1062,36 +1062,35 @@ _GLIBCXX_BEGIN_NAMESPACE(std) void imag(float __val) { __imag__ _M_value = __val; } - complex& + complex& operator=(float __f) { - __real__ _M_value = __f; - __imag__ _M_value = 0.0f; + _M_value = __f; return *this; } - complex& + complex& operator+=(float __f) { - __real__ _M_value += __f; + _M_value += __f; return *this; } - complex& + complex& operator-=(float __f) { - __real__ _M_value -= __f; + _M_value -= __f; return *this; } - complex& + complex& operator*=(float __f) { _M_value *= __f; return *this; } - complex& + complex& operator/=(float __f) { _M_value /= __f; @@ -1103,7 +1102,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // complex& operator=(const complex&); template - complex& + complex& operator=(const complex<_Tp>& __z) { __real__ _M_value = __z.real(); @@ -1112,7 +1111,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator+=(const complex<_Tp>& __z) { __real__ _M_value += __z.real(); @@ -1121,7 +1120,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator-=(const complex<_Tp>& __z) { __real__ _M_value -= __z.real(); @@ -1130,7 +1129,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator*=(const complex<_Tp>& __z) { _ComplexT __t; @@ -1141,7 +1140,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator/=(const complex<_Tp>& __z) { _ComplexT __t; @@ -1208,36 +1207,35 @@ _GLIBCXX_BEGIN_NAMESPACE(std) void imag(double __val) { __imag__ _M_value = __val; } - complex& + complex& operator=(double __d) { - __real__ _M_value = __d; - __imag__ _M_value = 0.0; + _M_value = __d; return *this; } - complex& + complex& operator+=(double __d) { - __real__ _M_value += __d; + _M_value += __d; return *this; } - complex& + complex& operator-=(double __d) { - __real__ _M_value -= __d; + _M_value -= __d; return *this; } - complex& + complex& operator*=(double __d) { _M_value *= __d; return *this; } - complex& + complex& operator/=(double __d) { _M_value /= __d; @@ -1248,7 +1246,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // complex& operator=(const complex&); template - complex& + complex& operator=(const complex<_Tp>& __z) { __real__ _M_value = __z.real(); @@ -1257,7 +1255,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator+=(const complex<_Tp>& __z) { __real__ _M_value += __z.real(); @@ -1266,7 +1264,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator-=(const complex<_Tp>& __z) { __real__ _M_value -= __z.real(); @@ -1275,7 +1273,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator*=(const complex<_Tp>& __z) { _ComplexT __t; @@ -1286,7 +1284,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator/=(const complex<_Tp>& __z) { _ComplexT __t; @@ -1354,36 +1352,35 @@ _GLIBCXX_BEGIN_NAMESPACE(std) void imag(long double __val) { __imag__ _M_value = __val; } - complex& + complex& operator=(long double __r) { - __real__ _M_value = __r; - __imag__ _M_value = 0.0L; + _M_value = __r; return *this; } - complex& + complex& operator+=(long double __r) { - __real__ _M_value += __r; + _M_value += __r; return *this; } - complex& + complex& operator-=(long double __r) { - __real__ _M_value -= __r; + _M_value -= __r; return *this; } - complex& + complex& operator*=(long double __r) { _M_value *= __r; return *this; } - complex& + complex& operator/=(long double __r) { _M_value /= __r; @@ -1394,7 +1391,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // complex& operator=(const complex&); template - complex& + complex& operator=(const complex<_Tp>& __z) { __real__ _M_value = __z.real(); @@ -1403,7 +1400,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator+=(const complex<_Tp>& __z) { __real__ _M_value += __z.real(); @@ -1412,7 +1409,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator-=(const complex<_Tp>& __z) { __real__ _M_value -= __z.real(); @@ -1421,7 +1418,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator*=(const complex<_Tp>& __z) { _ComplexT __t; @@ -1432,7 +1429,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template - complex& + complex& operator/=(const complex<_Tp>& __z) { _ComplexT __t; -- 2.7.4