Defer: Allow empty initialization & add `SetFunc()` method

This commit is contained in:
Yonas Habteab 2024-02-13 09:31:40 +01:00
parent 73db30c08b
commit a5a83e311a
1 changed files with 7 additions and 0 deletions

View File

@ -22,6 +22,8 @@ public:
{
}
Defer() = default;
Defer(const Defer&) = delete;
Defer(Defer&&) = delete;
Defer& operator=(const Defer&) = delete;
@ -39,6 +41,11 @@ public:
}
}
inline void SetFunc(std::function<void()> func)
{
m_Func = std::move(func);
}
inline
void Cancel()
{