Re: [CINT] [Fwd: [ROOT] string streams f

From: Jiri Masik (masik@pc203b.fzu.cz)
Date: Sun Jan 20 2002 - 17:25:55 MET


Masaharu Goto <MXJ02154@nifty.ne.jp> writes:

> Hello Jiri,
> 
> >root [0] ostrstream buf; buf << 1 << ends;
> >root [1] buf.str()
> >(const basic_ostringstream<char,char_traits<char>,allocator<char>
> >>::__string_type)275332816
> >
> >The return type of ostrstream.str() is different from how it works on
> >root compiled with gcc-2.95. It used to return char* which is
> >consistent with the docs at
> >http://darbujan.fzu.cz/cgi-bin/info2www?(iostream-295)Strings
> >Returning this type is what ostringstream should do I believe.
                               ^^^^^^^^^^^^^
> 
> As I look into ANSI/ISO C++ standard, it says
> 
>          basic_string<charT,traits,Allocator> str() const;
>          void    str(const basic_string<charT,traits,Allocator>& s);
> 
> And basic_ostringstream<char,char_traits<char>,allocator<char>::__string_type
> is defined as basic_string<char,char_traits<char>,allocator<char> > which
> is typedefed as string.  So, Cint with gcc3 behaves as it supposed to be.
> In fact, I simply mirror what is defined in the standard header file and
> I can not do much in this regard.
> 

Hello Masaharu,

I'm sorry for the typo it should read ostrstream. I agree with your
description of ostringstream behaviour. However I was pointing at the
change which happened with ostrstream. Or does the standard mention
its definition as well? I know it is a deprecated feature now and I will
not use it but it was the only option for people with earlier versions
of gcc as gcc-3 is the first one which implements ostringstream.

        Jiri
        



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:39 MET