Defer: Allow empty initialization & add SetFunc() method

This commit is contained in:
Yonas Habteab 2024-02-13 09:31:40 +01:00 committed by Alexander A. Klimov
parent 5f2d31bf3c
commit b0b41b1aff

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()
{