This produces garbage:
#include <iostream>
#include <sstream>
main()
{
std::ostringstream s1;
s1 << "s" << 1;
std::cout << s1 << std::endl;
}
This produces garbage. I realize the fix is to use s1.str()
. I'm wondering why ostream::operator<<
can take the ostringstream
arg if it "doesn't work properly".