I am clearing a std::stringstream
the usual way:
std::ostringstream ss;
for(...; ...; ...) {
... // Use ss.
if(some_condition_to_reset_stringstream) {
ss.str(std::string());
ss.clear();
}
... // Use ss some more.
}
Unfortunately, this does not clear any sticky manipulators (std::hex
, std::setfill
, etc.).
Is there some way to reset the entire std::stringstream
, including any IO manipulators? Or do I have to manually reset each manipulator individually (hopefully not forgetting any in the process)?