summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-12-25 20:05:34 +0100
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-12-25 20:05:34 +0100
commit1a5c9e6f03345bd2585928e7a6f51a5eec0c3919 (patch)
tree848e56bee69be6ba80520094fa0d85d83afc6bf3
parentd1a8ea04cba8184c4b9f38009378de42173462f2 (diff)
parent24eca6aa60f0848ad671b1fe11351d6e911b14e0 (diff)
Merge branch 'master' of /pub/repo.git/Balau
-rw-r--r--includes/Exceptions.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/Exceptions.h b/includes/Exceptions.h
index 47bd1f5..799bfb6 100644
--- a/includes/Exceptions.h
+++ b/includes/Exceptions.h
@@ -2,6 +2,7 @@
#include <stdarg.h>
#include <typeinfo>
+#include <functional>
#ifndef _MSC_VER
#include <cxxabi.h>
@@ -174,3 +175,11 @@ ClassName::ClassName(T * ptr) {
msg.set("UnitTest Assert " #c " failed at %s:%i", __FILE__, __LINE__); \
Balau::TestHelper(msg); \
}
+
+class ScopedLambda {
+ public:
+ ScopedLambda(std::function<void()> l) : m_l(l) { }
+ ~ScopedLambda() { m_l(); }
+ private:
+ std::function<void()> m_l;
+};