File indexing completed on 2025-01-18 09:53:52
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_XPRESSIVE_DETAIL_UTILITY_SAVE_RESTORE_HPP_EAN_10_04_2005
0009 #define BOOST_XPRESSIVE_DETAIL_UTILITY_SAVE_RESTORE_HPP_EAN_10_04_2005
0010
0011
0012 #if defined(_MSC_VER)
0013 # pragma once
0014 #endif
0015
0016 #include <boost/noncopyable.hpp>
0017
0018 namespace boost { namespace xpressive { namespace detail
0019 {
0020
0021 template<typename T>
0022 struct save_restore
0023 : private noncopyable
0024 {
0025 explicit save_restore(T &t)
0026 : ref(t)
0027 , val(t)
0028 {
0029 }
0030
0031 save_restore(T &t, T const &n)
0032 : ref(t)
0033 , val(t)
0034 {
0035 this->ref = n;
0036 }
0037
0038 ~save_restore()
0039 {
0040 this->ref = this->val;
0041 }
0042
0043 void restore()
0044 {
0045 this->ref = this->val;
0046 }
0047
0048 private:
0049 T &ref;
0050 T const val;
0051 };
0052
0053 }}}
0054
0055 #endif