1 #ifndef VTESTBED_BASE_IOS_GUARD_HH 2 #define VTESTBED_BASE_IOS_GUARD_HH 14 std::ios::iostate _oldstate;
19 ios_guard(std::ios& ios): _ios(ios) { this->save(); }
20 ~
ios_guard() noexcept { this->restore(); }
24 this->_oldstate = this->_ios.exceptions();
29 try { this->_ios.exceptions(this->_oldstate); }
catch (...) { }
43 #endif // vim:filetype=cpp