On MSVC 2005, I have the following code.
std::ostringstream stream("initial string ");
stream << 5;
std::cout << stream.str();
What I expect is:
initial string 5
What I get is:
5nitial string
Initializing the stream with a string, I would expect the stream to move its position to the end of the initial string. Obviously, STL doesn't agree with me (not the first time).
What's the purpose of such behavior? Is this use case useful for anything? Also, is there a way to advance the stream position to the end of the initial string?