Calculator  Step 6
ioflags.hpp
Go to the documentation of this file.
1 #ifndef IOFLAGS_HPP_
2 #define IOFLAGS_HPP_
3 
15 class ioflags
16 {
17 public:
20  ioflags(std::basic_ios<char>& stream) : stream_(stream), flags_{stream.flags()} {}
22  ~ioflags() { stream_.flags(flags_); }
23 private:
24  std::basic_ios<char>& stream_;
25  std::ios_base::fmtflags flags_;
26 };
27 
28 #endif
ioflags(std::basic_ios< char > &stream)
Definition: ioflags.hpp:20
std::ios_base::fmtflags flags_
Definition: ioflags.hpp:25
std::basic_ios< char > & stream_
Definition: ioflags.hpp:24
~ioflags()
Restore the formatting flags.
Definition: ioflags.hpp:22