[Patch] libstdc++/28080, fourth installment

Bo Persson bop@gmb.dk
Tue Feb 27 16:37:00 GMT 2007



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




More information about the Libstdc++ mailing list