[libstdc++ PATCH] Reminder: PR 3955

Benjamin Kosnik bkoz@redhat.com
Fri Mar 1 17:46:00 GMT 2002


> The bug is that when an ostringstream is opened in "append" mode, we don't
> append to it, we overwrite from the beginning.  We were/are already checking
> for "at end" but with this patch we'll check for either mode.

Ok. This is cool for mainline and gcc-3_1-branch. I was testing with this, 
which makes it clearer to me, at least:

#include <sstream>

bool test04()
{
  bool test = true;
  
  std::ostringstream os("Maya");
  os << " Ying";
  os << " Lin";
  test = os.str() == " Ying Lin";
  
  return test;
}

bool test05()
{
  bool test = true;
  
  std::ostringstream os("Maya", std::ios::app);
  os << " Ying";
  os << " Lin";
  test = os.str() == "Maya Ying Lin";
  
  return test;
}


int main()
{
  test04();
  test05();
  return 0;
}



More information about the Libstdc++ mailing list