BAN: Add basic ScopeGuard

This commit is contained in:
Bananymous 2023-01-23 17:41:34 +02:00
parent 1b9f7aa815
commit 7c6d474a3a
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#pragma once
#include <BAN/Function.h>
namespace BAN
{
class ScopeGuard
{
public:
ScopeGuard(const BAN::Function<void()>& func)
: m_func(func)
{ }
~ScopeGuard()
{
m_func();
}
private:
BAN::Function<void()> m_func;
};
}