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


Bo Persson wrote:

-    {
-      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.

Oh, yes, thanks for noticing, and, I must add, I didn't know 26.2.6/15 was mandating that exact behavior, sigh. To be safe, for now I will punt on the <complex> bits...


Thanks again,
Paolo.


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