Merge branch 'master' into windows-clang

This commit is contained in:
qurious-pixel 2025-11-14 15:30:06 -08:00 committed by GitHub
commit b66d94b398
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
88 changed files with 1972 additions and 798 deletions

27
Utilities/deferred_op.hpp Normal file
View file

@ -0,0 +1,27 @@
#pragma once
// Generic deferred routine wrapper
// Use-case is similar to "defer" statement in other languages, just invokes a callback when the object goes out of scope
#include <functional>
namespace utils
{
template <typename F>
requires std::is_invocable_v<F>
class deferred_op
{
public:
deferred_op(F&& callback)
: m_callback(callback)
{}
~deferred_op()
{
m_callback();
}
private:
F m_callback;
};
}