diff options
author | hnOsmium0001 <[email protected]> | 2022-04-15 20:30:39 -0700 |
---|---|---|
committer | hnOsmium0001 <[email protected]> | 2022-04-15 20:30:39 -0700 |
commit | 509201784d6525fc26345e55a56ab81e4a7616b3 (patch) | |
tree | bcd68f247937324d06480b58a284b47e1c6bb2b8 /source/ScopeGuard.hpp | |
parent | 989f90ebe2c37e8a517691a35d7e0d827fbe7006 (diff) |
Work on Material system
Diffstat (limited to 'source/ScopeGuard.hpp')
-rw-r--r-- | source/ScopeGuard.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/ScopeGuard.hpp b/source/ScopeGuard.hpp index b4a1749..28f3385 100644 --- a/source/ScopeGuard.hpp +++ b/source/ScopeGuard.hpp @@ -49,5 +49,12 @@ public: } }; +template <class T> +auto GuardDeletion(T* ptr) { + return ScopeGuard([ptr]() { + delete ptr; + }); +} + #define SCOPE_GUARD(name) ScopeGuard name = [&]() #define DEFER ScopeGuard UNIQUE_NAME(scopeGuard) = [&]() |