summaryrefslogtreecommitdiff
path: root/src/common.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.hpp')
-rw-r--r--src/common.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common.hpp b/src/common.hpp
index 4cea1633..0363c334 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -412,5 +412,17 @@ RunIterable<T> runs(const ::std::vector<T>& x) {
return RunIterable<T>(x);
}
+template<typename T>
+class NullOnDrop {
+ T*& ptr;
+public:
+ NullOnDrop(T*& ptr):
+ ptr(ptr)
+ {}
+ ~NullOnDrop() {
+ ptr = nullptr;
+ }
+};
+
#endif