summaryrefslogtreecommitdiff
path: root/core/include/fxcrt/fx_basic.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/include/fxcrt/fx_basic.h')
-rw-r--r--core/include/fxcrt/fx_basic.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index 62324f5b2a..7ad44c6b4d 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
{