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] Fix libstdc++/9561


>2003-02-24  Jerry Quinn  <jlquinn at us dot ibm dot com>
>
>        * include/bits/basic_ios.h (_M_setstate): New.
>	* include/bits/ostream.tcc (operator<<): Use it.
>	* include/std/std_ostream.h (operator<<): Make friends.

This patch is the right idea, thanks. However, a couple of things.

1) this needs to be done for istream.tcc as well

2) needs testcases for both istream and ostream bits

3) template friend bits should look (something) like:

Index: include/std/std_ostream.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/std/std_ostream.h,v
retrieving revision 1.7
diff -c -p -r1.7 std_ostream.h
*** include/std/std_ostream.h	7 Feb 2003 00:26:44 -0000	1.7
--- include/std/std_ostream.h	7 Mar 2003 07:53:07 -0000
*************** namespace std
*** 73,78 ****
--- 73,102 ----
        typedef num_put<_CharT, __ostreambuf_iter>        __numput_type;
        typedef ctype<_CharT>           			__ctype_type;
  
+       template<typename _CharT2, typename _Traits2>
+         friend basic_ostream<_CharT2, _Traits2>&
+         operator<<(basic_ostream<_CharT2, _Traits2>&, _CharT2);
+ 
+ #if 1
+       template<typename _Traits2>
+         friend basic_ostream<char, _Traits2>&
+         operator<<(basic_ostream<char, _Traits2>&, char);
+ #endif
+ 
+       template<typename _CharT2, typename _Traits2>
+         friend basic_ostream<_CharT2, _Traits2>&
+         operator<<(basic_ostream<_CharT2, _Traits2>&, const _CharT2*);
+ 
+ #if 1
+       template<typename _Traits2>
+         friend basic_ostream<char, _Traits2>&
+         operator<<(basic_ostream<char, _Traits2>&, const char*);
+ #endif
+ 
+       template<typename _CharT2, typename _Traits2>
+         friend basic_ostream<_CharT2, _Traits2>&
+         operator<<(basic_ostream<_CharT2, _Traits2>&, const char*);
+ 
        // [27.6.2.2] constructor/destructor
        /**
         *  @brief  Base constructor.

At the moment, the #if/#endif bits are necessary, but I'm not quite sure why.

-benjamin

Attachment: p.20030307-1
Description: Binary data


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