diff mbox

[v3] Small clean-up to <complex>

Message ID 4EB87D66.9080106@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Nov. 8, 2011, 12:52 a.m. UTC
Hi,

Marc noticed we had a few redundant const qualifiers.

Tested x86_64-linux, committed.

Paolo.

//////////////////
2011-11-07  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/std/complex (complex<>::real(), complex<>::imag()):
	Remove redundant const qualifiers.

Comments

Gabriel Dos Reis Nov. 8, 2011, 1:43 a.m. UTC | #1
On Mon, Nov 7, 2011 at 6:52 PM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> Marc noticed we had a few redundant const qualifiers.

Yes and no.  They were left redundant NOT out of careless
or lazyness.
At the time, it was lobbied hard that for transitional purposes,
#defning constexpr to nothing should still let the header
compile and that there was no need for code duplication
for the same thing.   And that was also the basis of
modifying the original constexpr proposal to allow
the redundant const.

>
> Tested x86_64-linux, committed.
>
> Paolo.
>
> //////////////////
>
Paolo Carlini Nov. 8, 2011, 1:45 a.m. UTC | #2
On 11/08/2011 02:43 AM, Gabriel Dos Reis wrote:
> On Mon, Nov 7, 2011 at 6:52 PM, Paolo Carlini<paolo.carlini@oracle.com>  wrote:
>> Hi,
>>
>> Marc noticed we had a few redundant const qualifiers.
> Yes and no.  They were left redundant NOT out of careless
> or lazyness.
> At the time, it was lobbied hard that for transitional purposes,
> #defning constexpr to nothing should still let the header
> compile and that there was no need for code duplication
> for the same thing.   And that was also the basis of
> modifying the original constexpr proposal to allow
> the redundant const.
I see, thanks for the explanation!

Paolo.
diff mbox

Patch

Index: include/std/complex
===================================================================
--- include/std/complex	(revision 181138)
+++ include/std/complex	(working copy)
@@ -142,10 +142,10 @@ 
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // DR 387. std::complex over-encapsulated.
       constexpr _Tp 
-      real() const { return _M_real; }
+      real() { return _M_real; }
 
       constexpr _Tp 
-      imag() const { return _M_imag; }
+      imag() { return _M_imag; }
 #else
       ///  Return real part of complex number.
       _Tp& 
@@ -1062,10 +1062,10 @@ 
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // DR 387. std::complex over-encapsulated.
       constexpr float 
-      real() const { return __real__ _M_value; }
+      real() { return __real__ _M_value; }
 
       constexpr float 
-      imag() const { return __imag__ _M_value; }
+      imag() { return __imag__ _M_value; }
 #else
       float& 
       real() { return __real__ _M_value; }
@@ -1211,10 +1211,10 @@ 
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // DR 387. std::complex over-encapsulated.
       constexpr double 
-      real() const { return __real__ _M_value; }
+      real() { return __real__ _M_value; }
 
       constexpr double 
-      imag() const { return __imag__ _M_value; }
+      imag() { return __imag__ _M_value; }
 #else
       double& 
       real() { return __real__ _M_value; }
@@ -1361,10 +1361,10 @@ 
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // DR 387. std::complex over-encapsulated.
       constexpr long double 
-      real() const { return __real__ _M_value; }
+      real() { return __real__ _M_value; }
 
       constexpr long double 
-      imag() const { return __imag__ _M_value; }
+      imag() { return __imag__ _M_value; }
 #else
       long double& 
       real() { return __real__ _M_value; }