diff options
Diffstat (limited to 'graphs/cpp/cartesian_vector/state_saver.hh')
| -rw-r--r-- | graphs/cpp/cartesian_vector/state_saver.hh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/graphs/cpp/cartesian_vector/state_saver.hh b/graphs/cpp/cartesian_vector/state_saver.hh new file mode 100644 index 0000000..f52127c --- /dev/null +++ b/graphs/cpp/cartesian_vector/state_saver.hh @@ -0,0 +1,20 @@ +#pragma once + +#include <iostream> + +class StateSaver +{ +public: + //! constructor should save all flags and precision + StateSaver(std::ostream& os); + //! destructor should restore all flags and precision + ~StateSaver(); + +private: + //! original stream + std::ostream& saved_stream_; + //! flags of the original stream + std::ios_base::fmtflags saved_flags_; + //! precision of the original stream + std::streamsize saved_precision_; +}; |
