[Bug libstdc++/50501] Insertion of complex into a stream may fail without invalidating the stream
paolo.carlini at oracle dot com
gcc-bugzilla@gcc.gnu.org
Sat Sep 24 04:12:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50501
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-23 23:58:54 UTC ---
The Standard is very precise here, and nothing changed for C++11. It says,
literally:
Effects: inserts the complex number x onto the stream o as if it were
implemented as follows:
template<class T, class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& o, const complex<T>& x) {
basic_ostringstream<charT, traits> s;
s.flags(o.flags());
s.imbue(o.getloc());
s.precision(o.precision());
s << ’(’ << x.real() << "," << x.imag() << ’)’;
return o << s.str();
}
thus, I don't see how we could to something else, like what you are suggesting,
and remain conforming.
More information about the Gcc-bugs
mailing list