// -*- mode: c++; c-basic-offset: 2; -*- #ifndef IOS_SAVE_HH #define IOS_SAVE_HH #include class ios_save { public: ios_save(std::ostream& ostream) : ostream_(ostream), save_(nullptr) { save_.copyfmt(ostream); } ios_save(ios_save const& save) : ostream_(save.ostream_), save_(nullptr) { save_.copyfmt(save.save_); } ~ios_save() { ostream_.copyfmt(save_); } ios_save& operator=(ios_save const&) = delete; private: std::ostream& ostream_; std::ios save_; }; #endif // IOS_SAVE_HH