[Patch] libstdc++/28080, fourth installment

Paolo Carlini pcarlini@suse.de
Tue Feb 27 16:45:00 GMT 2007


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.



More information about the Libstdc++ mailing list