BAN: ScopeGuard can now be disabled (it wont call the function)
This commit is contained in:
parent
c7286396d8
commit
6a6717cdd3
|
@ -13,10 +13,16 @@ namespace BAN
|
|||
{ }
|
||||
~ScopeGuard()
|
||||
{
|
||||
if (m_enabled)
|
||||
m_func();
|
||||
}
|
||||
void disable()
|
||||
{
|
||||
m_enabled = false;
|
||||
}
|
||||
private:
|
||||
BAN::Function<void()> m_func;
|
||||
bool m_enabled { true };
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in New Issue