Legacy code I maintain collects text into an std::ostream. I'd like to convert this to a std::string.
I've found examples of converting std::sstringstream, std::ostringstream etc to std::string but not explicitly std::ostream to std::string.
How can I do that? (Ancient C++ 98 only, no boost please)