diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:23:48 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:23:48 +0200 |
commit | ee1c8c5c25d25dfa42120125a8a45dc9831ee412 (patch) | |
tree | 67aa287157db954e0cadeee05b4aad331eb2ecf2 /zen/scope_guard.h | |
parent | 5.13 (diff) | |
download | FreeFileSync-ee1c8c5c25d25dfa42120125a8a45dc9831ee412.tar.gz FreeFileSync-ee1c8c5c25d25dfa42120125a8a45dc9831ee412.tar.bz2 FreeFileSync-ee1c8c5c25d25dfa42120125a8a45dc9831ee412.zip |
5.14
Diffstat (limited to 'zen/scope_guard.h')
-rw-r--r-- | zen/scope_guard.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/zen/scope_guard.h b/zen/scope_guard.h index 81f47f87..ca05d39d 100644 --- a/zen/scope_guard.h +++ b/zen/scope_guard.h @@ -15,7 +15,7 @@ namespace zen { //Scope Guard /* - zen::ScopeGuard lockAio = zen::makeGuard([&]() { ::CancelIo(hDir); }); + zen::ScopeGuard lockAio = zen::makeGuard([&] { ::CancelIo(hDir); }); ... lockAio.dismiss(); */ @@ -33,13 +33,13 @@ public: protected: ScopeGuardBase() : dismissed_(false) {} ScopeGuardBase(ScopeGuardBase&& other) : dismissed_(other.dismissed_) { other.dismiss(); } //take over responsibility - ~ScopeGuardBase() {} + ~ScopeGuardBase() {} //[!] protected non-virtual base class destructor bool isDismissed() const { return dismissed_; } private: - ScopeGuardBase(const ScopeGuardBase&); //delete - ScopeGuardBase& operator=(const ScopeGuardBase&); // = delete; + ScopeGuardBase (const ScopeGuardBase&); // = delete + ScopeGuardBase& operator=(const ScopeGuardBase&); // bool dismissed_; }; @@ -76,6 +76,6 @@ ScopeGuardImpl<typename std::decay<F>::type> makeGuard(F&& fun) { return ScopeGu #define ZEN_CONCAT_SUB(X, Y) X ## Y #define ZEN_CONCAT(X, Y) ZEN_CONCAT_SUB(X, Y) -#define ZEN_ON_SCOPE_EXIT(X) zen::ScopeGuard ZEN_CONCAT(dummy, __LINE__) = zen::makeGuard([&]{ X; }); (void)ZEN_CONCAT(dummy, __LINE__); +#define ZEN_ON_SCOPE_EXIT(X) auto ZEN_CONCAT(dummy, __LINE__) = zen::makeGuard([&]{ X; }); (void)ZEN_CONCAT(dummy, __LINE__); #endif //ZEN_SCOPEGUARD_8971632487321434 |