
I want to save state once at the beggining of something and restore it multiple times after some steps that may pollute io state.
Nope, the classes are pure-RAII. The classes either save or do an "atomic" save-and-change in the constructor and restore in the destructor. There are no member functions you could even use for arbitrarily-timed restoring. If you could abuse the RAII paradigm to do this, then....
BTW, why would you need to do this unusual kind of multiple restoring in
Could I make an object during startup and then force restore by making copy and destroying one immediately? the
first place?
I want to save state of cout (or any other current log/report stream for that matter) at the start of test case/framework run and restore it after each assertion? Gennadiy