mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
AK: Make [,Armed]ScopeGuard non-copyable and non-movable
This commit is contained in:
1 parent
66087b32ce
commit
665ced177c
1 file changed
+7
@@ -6,12 +6,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Noncopyable.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
template<typename Callback>
|
||||
class ScopeGuard {
|
||||
AK_MAKE_NONCOPYABLE(ScopeGuard);
|
||||
AK_MAKE_NONMOVABLE(ScopeGuard);
|
||||
|
||||
public:
|
||||
constexpr ScopeGuard(Callback callback)
|
||||
: m_callback(move(callback))
|
||||
@@ -29,6 +33,9 @@ private:
|
||||
|
||||
template<typename Callback>
|
||||
class ArmedScopeGuard {
|
||||
AK_MAKE_NONCOPYABLE(ArmedScopeGuard);
|
||||
AK_MAKE_NONMOVABLE(ArmedScopeGuard);
|
||||
|
||||
public:
|
||||
ArmedScopeGuard(Callback callback)
|
||||
: m_callback(move(callback))
|
||||
|
||||
Reference in new issue
Block a user