Skip to content

OStringStream rewind probably not behaving as expected

The rewind only repositions the output pointer, but does not truncate the output buffer. Eg,

OStringStream os;
os << "1234567890";
os.rewind();
os << "abc";

produces "abc4567890" as output, not "abc" as may be expected.

Suggested recourse, provide explicit reset() method to reposition output pointer and buffer.

@andy