This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] libstdc++/28080, fourth installment




---- Original Message ----
From: "Paolo Carlini" <pcarlini@suse.de>
To: "libstdc++" <libstdc++@gcc.gnu.org>

_GLIBCXX_BEGIN_NAMESPACE(std) Index: include/std/complex =================================================================== --- include/std/complex (revision 122328) +++ include/std/complex (working copy)

@@ -514,16 +518,10 @@

  ///  Insertion operator for complex values.
  template<typename _Tp, typename _CharT, class _Traits>
-    basic_ostream<_CharT, _Traits>&
-    operator<<(basic_ostream<_CharT, _Traits>& __os, const
complex<_Tp>& __x)
-    {
-      basic_ostringstream<_CharT, _Traits> __s;
-      __s.flags(__os.flags());
-      __s.imbue(__os.getloc());
-      __s.precision(__os.precision());
-      __s << '(' << __x.real() << ',' << __x.imag() << ')';
-      return __os << __s.str();
-    }
+    std::basic_ostream<_CharT, _Traits>&
+    operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+        const complex<_Tp>& __x)
+    { return __os << '(' << __x.real() << ',' << __x.imag() << ')';
}


This isn't exactly equivalent, as the default constructed stringstream will have default values for width() and fill(). The __os parameter might not.



Bo Persson




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]