From ee1c8c5c25d25dfa42120125a8a45dc9831ee412 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:23:48 +0200 Subject: 5.14 --- zen/scope_guard.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'zen/scope_guard.h') 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::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 -- cgit