mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-09-06 09:55:11 -04:00
a6f059827b
* Game ABI / headers refactoring * Delete dusk/imgui.h
18 lines
366 B
C++
18 lines
366 B
C++
#pragma once
|
|
|
|
#include <functional>
|
|
|
|
class SimpleScopeGuard {
|
|
public:
|
|
// Store the function in the constructor
|
|
explicit SimpleScopeGuard(const std::function<void()>& func) : m_func(func) {}
|
|
|
|
// Run the function when the object goes out of scope
|
|
~SimpleScopeGuard() {
|
|
if (m_func) m_func();
|
|
}
|
|
|
|
private:
|
|
std::function<void()> m_func;
|
|
};
|