From 015bb675d6eb177900c8ac94a6d35edc5ad90576 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Wed, 9 May 2018 00:11:35 +0200 Subject: 9.9 --- zen/scope_guard.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'zen/scope_guard.h') diff --git a/zen/scope_guard.h b/zen/scope_guard.h index 6945b011..328e2caa 100755 --- a/zen/scope_guard.h +++ b/zen/scope_guard.h @@ -115,6 +115,10 @@ auto makeGuard(F&& fun) { return ScopeGuard>(std::forwa #define ZEN_CONCAT_SUB(X, Y) X ## Y #define ZEN_CONCAT(X, Y) ZEN_CONCAT_SUB(X, Y) +#define ZEN_CHECK_CASE_FOR_CONSTANT(X) case X: return ZEN_CHECK_CASE_FOR_CONSTANT_IMPL(#X) +#define ZEN_CHECK_CASE_FOR_CONSTANT_IMPL(X) L ## X + + #define ZEN_ON_SCOPE_EXIT(X) auto ZEN_CONCAT(dummy, __LINE__) = zen::makeGuard([&]{ X; }); (void)ZEN_CONCAT(dummy, __LINE__); #define ZEN_ON_SCOPE_FAIL(X) auto ZEN_CONCAT(dummy, __LINE__) = zen::makeGuard([&]{ X; }); (void)ZEN_CONCAT(dummy, __LINE__); #define ZEN_ON_SCOPE_SUCCESS(X) auto ZEN_CONCAT(dummy, __LINE__) = zen::makeGuard([&]{ X; }); (void)ZEN_CONCAT(dummy, __LINE__); -- cgit