diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2018-05-09 00:11:35 +0200 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2018-05-09 00:11:35 +0200 |
commit | 015bb675d6eb177900c8ac94a6d35edc5ad90576 (patch) | |
tree | edde4153ce9b2ba6bdaf9d3c0af0966ed6dfd717 /zen/scope_guard.h | |
parent | 9.8 (diff) | |
download | FreeFileSync-015bb675d6eb177900c8ac94a6d35edc5ad90576.tar.gz FreeFileSync-015bb675d6eb177900c8ac94a6d35edc5ad90576.tar.bz2 FreeFileSync-015bb675d6eb177900c8ac94a6d35edc5ad90576.zip |
9.9
Diffstat (limited to 'zen/scope_guard.h')
-rwxr-xr-x | zen/scope_guard.h | 4 |
1 files changed, 4 insertions, 0 deletions
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<runMode, std::decay_t<F>>(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<zen::ScopeGuardRunMode::ON_EXIT >([&]{ X; }); (void)ZEN_CONCAT(dummy, __LINE__); #define ZEN_ON_SCOPE_FAIL(X) auto ZEN_CONCAT(dummy, __LINE__) = zen::makeGuard<zen::ScopeGuardRunMode::ON_FAIL >([&]{ X; }); (void)ZEN_CONCAT(dummy, __LINE__); #define ZEN_ON_SCOPE_SUCCESS(X) auto ZEN_CONCAT(dummy, __LINE__) = zen::makeGuard<zen::ScopeGuardRunMode::ON_SUCCESS>([&]{ X; }); (void)ZEN_CONCAT(dummy, __LINE__); |