Patchwork [v3] N3669

login
register
mail settings
Submitter Paolo Carlini
Date April 22, 2013, 10:45 a.m.
Message ID <517514B3.40605@oracle.com>
Download mbox | patch
Permalink /patch/238435/
State New
Headers show

Comments

Paolo Carlini - April 22, 2013, 10:45 a.m.
Hi,

I went through the items noticed by Nico in the paper and voted to the 
wp, and we are missing only the following, I think we can do the change now.

Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////////
2013-04-22  Paolo Carlini  <paolo.carlini@oracle.com>

	N3669
	* include/std/complex (complex<float>::real, complex<float>::imag,
	complex<double>::real, complex<double>::imag,
	complex<long double>::real, complex<long double>::imag): Declare
	as const member functions.
	* include/std/type_traits (integral_constant<>::operator value_type):
	Likewise.

Patch

Index: include/std/complex
===================================================================
--- include/std/complex	(revision 198124)
+++ include/std/complex	(working copy)
@@ -1066,11 +1066,11 @@ 
       // DR 387. std::complex over-encapsulated.
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr float 
-      real() { return __real__ _M_value; }
+      real() const { return __real__ _M_value; }
 
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr float 
-      imag() { return __imag__ _M_value; }
+      imag() const { return __imag__ _M_value; }
 #else
       float& 
       real() { return __real__ _M_value; }
@@ -1217,11 +1217,11 @@ 
       // DR 387. std::complex over-encapsulated.
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr double 
-      real() { return __real__ _M_value; }
+      real() const { return __real__ _M_value; }
 
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr double 
-      imag() { return __imag__ _M_value; }
+      imag() const { return __imag__ _M_value; }
 #else
       double& 
       real() { return __real__ _M_value; }
@@ -1369,11 +1369,11 @@ 
       // DR 387. std::complex over-encapsulated.
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr long double 
-      real() { return __real__ _M_value; }
+      real() const { return __real__ _M_value; }
 
       __attribute ((__abi_tag__ ("cxx11")))
       constexpr long double 
-      imag() { return __imag__ _M_value; }
+      imag() const { return __imag__ _M_value; }
 #else
       long double& 
       real() { return __real__ _M_value; }
Index: include/std/type_traits
===================================================================
--- include/std/type_traits	(revision 198124)
+++ include/std/type_traits	(working copy)
@@ -59,7 +59,7 @@ 
       static constexpr _Tp                  value = __v;
       typedef _Tp                           value_type;
       typedef integral_constant<_Tp, __v>   type;
-      constexpr operator value_type() { return value; }
+      constexpr operator value_type() const { return value; }
     };
   
   template<typename _Tp, _Tp __v>