blob: 1abcf53b16e8c3b5b63ac020b825621417856903 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// -*- mode: c++; c-basic-offset: 2; -*-
#ifndef IOS_SAVE_HH
#define IOS_SAVE_HH
#include <ostream>
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
|