Added two new commands
This commit is contained in:
parent
316afd9f56
commit
4a9d8f132f
13
src/misc/scope_guard.h
Normal file
13
src/misc/scope_guard.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
template <typename callback_t>
|
||||
struct scope_exit_callback {
|
||||
public:
|
||||
scope_exit_callback(callback_t&& callback) : callback(std::forward<callback_t>(callback)) {}
|
||||
~scope_exit_callback() {
|
||||
this->callback();
|
||||
}
|
||||
|
||||
private:
|
||||
callback_t callback;
|
||||
};
|
Loading…
Reference in New Issue
Block a user