summaryrefslogtreecommitdiff
path: root/include/scope.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scope.h')
-rw-r--r--include/scope.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/scope.h b/include/scope.h
index b9e2e96ae5c..e0e9fc62969 100644
--- a/include/scope.h
+++ b/include/scope.h
@@ -64,3 +64,11 @@ make_scope_exit(Callable &&f)
return detail::scope_exit<typename std::decay<Callable>::type>(
std::forward<Callable>(f));
}
+
+#define CONCAT_IMPL(x, y) x##y
+
+#define CONCAT(x, y) CONCAT_IMPL(x, y)
+
+#define ANONYMOUS_VARIABLE CONCAT(_anonymous_variable, __LINE__)
+
+#define SCOPE_EXIT auto ANONYMOUS_VARIABLE= make_scope_exit