std::ostream's have a flush() method which:
Writes uncommitted changes to the underlying output sequence.
What does that mean for an std::stringstream? If I understand correctly, it means there's nothing to be done for such a stream. Is this true?
flush() triggers a call of the stream's rdbuf member's pubsync() method (which in turn calls sync() ). For string streams, the rdbuf is a std::basic_stringbuf, and as the link indicates, its pubsync()/sync() behavior is to do nothing.
Thus, indeed, your assumption is valid: std::stringstream::flush() does nothing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With