ostringstream stdlibc++-2.90.8pre1

Bill Thompson billt@toast.net
Sat Apr 1 00:00:00 GMT 2000


I don't know if I'm hacking around where I'm not supposed to
but here it goes...... It's a small change to such great work
you guys are doing, probably a typo at that :). 


//-Problem-------------------------------------------------------
#include <iostream>
#include <sstream>

int main()
{
       std::ostringstream Bill("Some Day Will Come");
       std::cout << Bill.str() << std::endl; // OK "not"
       Bill << " Tomorrow";  // overwrites first part of buffer ?
       std::cout << Bill.str() << std::endl;
       Bill << " Won't";  // appends to second string ?
       std::cout << Bill.str();
        
}
//-------------------------------------------------------------

std_sstream.h changed the following noted below

      void
      _M_init_stringbuf(ios_base::openmode __mode)
      {
        _M_buf_size = _M_string.size();
        _M_mode = __mode;
        _M_really_sync(0,_M_buf_size); // <--changed here Bill T
      }


More information about the Libstdc++ mailing list