Common: add on_scope_exit utility for scope-based resource management

This commit is contained in:
李通洲
2026-01-13 18:33:02 +08:00
parent 49fc95689d
commit e6bd1c340f
5 changed files with 23 additions and 37 deletions
+1 -9
View File
@@ -4,20 +4,12 @@ extern "C" {
}
#include "common/windows/com.hpp"
#include "common/windows/unicode.hpp"
#include "common/windows/util.hpp"
#include <initguid.h>
#include <mfapi.h>
#include <mfidl.h>
template <typename Fn>
struct on_scope_exit {
on_scope_exit(Fn &&fn): _fn(std::move(fn)) {}
~on_scope_exit() { this->_fn(); }
private:
Fn _fn;
};
extern "C"
const char* ffDetectCamera(FF_MAYBE_UNUSED FFlist* result)
{