Index: core/include/fxcrt/fx_basic.h |
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h |
index 62324f5b2a6f53a7dc82c963cf25b09f5797e48c..7ad44c6b4d7208a221de80a70c27aaf6944b9e14 100644 |
--- a/core/include/fxcrt/fx_basic.h |
+++ b/core/include/fxcrt/fx_basic.h |
@@ -1414,6 +1414,21 @@ protected: |
CFX_DataFilter* m_pDestFilter; |
}; |
+ |
+template<typename T> |
+class CFX_AutoRestorer { |
+public: |
+ explicit CFX_AutoRestorer(T* location) { |
+ m_Location = location; |
+ m_OldValue = *location; |
+ } |
+ ~CFX_AutoRestorer() { *m_Location = m_OldValue; } |
+ |
+private: |
+ T* m_Location; |
+ T m_OldValue; |
+}; |
+ |
template <class T> |
class CFX_SmartPointer |
{ |