Hello Jiri, I looked into this again, but I could not reproduce the problem yet. Everything works fine on my machine. Could you check following? root[0] #include <fstream> root[1] #include <string> root[2] ./G__ateval (Please check that you find G__ateval(const string& x) in the list) (const basic_ostringstream<char,char_traits<char>,allocator<char> ::__string_type) should be typedefed as string and G__ateval(const string& x) has to be called at the end of buf.str() evaluation. Then it has to behave just like str() returns 'char*'. New C++ standard says str() returns 'string' and not 'char*'. I am still wondering what goes wrong?? Thank you Masaharu Goto >Date: Sun, 20 Jan 2002 10:41:24 +0900]] >From: Masaharu Goto <MXJ02154@nifty.ne.jp >To: masik@pc203b.fzu.cz >Cc: roottalk@pcroot.cern.ch, cint@pcroot.cern.ch >Subject: RE:Re: [CINT] [Fwd: [ROOT] string streams f > >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. > > >>Second try: >>Including headers results in the following error >>root [0] #include <string> >>root [1] #include <strstream> >>root [2] ostrstream buf; buf << 1 << ends; >>root [3] buf.str() >>Internal error: template function call G__ateval failed FILE: LINE:0 >>(const basic_ostringstream<char,char_traits<char>,allocator<char> >>>::__string_type)276003640 >>*** Interpreter error recovered *** > >This is peculiar. Same thing works on my machine. >It looks like evaluation of buf.str() is performed just fine. Problem >occurs when Cint tries to print it out with G__ateval function template. >In fact, G__ateval function template should not be used because >specialized version is defined in <string>. Let me investigate. > > >>I tried also the ostringstream class > >I simply typedef ostringstream and ostrstream to be identical type. >So, they should behave exactly the same way. > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:39 MET