summaryrefslogtreecommitdiff
path: root/src/helpers/ScopeGuard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/helpers/ScopeGuard.cpp')
-rw-r--r--src/helpers/ScopeGuard.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/helpers/ScopeGuard.cpp b/src/helpers/ScopeGuard.cpp
new file mode 100644
index 00000000..319255cd
--- /dev/null
+++ b/src/helpers/ScopeGuard.cpp
@@ -0,0 +1,10 @@
+#include "ScopeGuard.hpp"
+
+CScopeGuard::CScopeGuard(const std::function<void()>& fn_) : fn(fn_) {
+ ;
+}
+
+CScopeGuard::~CScopeGuard() {
+ if (fn)
+ fn();
+}