[ox/std] Cleanup Defer
This commit is contained in:
parent
5834b9c98d
commit
76760dafb6
9
deps/ox/src/ox/std/defer.hpp
vendored
9
deps/ox/src/ox/std/defer.hpp
vendored
@ -8,8 +8,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "error.hpp"
|
||||
|
||||
namespace ox {
|
||||
|
||||
template<typename T>
|
||||
@ -18,13 +16,12 @@ class Defer {
|
||||
T m_deferredFunc;
|
||||
|
||||
public:
|
||||
Defer(T deferredFunc) {
|
||||
m_deferredFunc = deferredFunc;
|
||||
constexpr Defer(T deferredFunc) noexcept: m_deferredFunc(deferredFunc) {
|
||||
}
|
||||
|
||||
Defer(const Defer&) = delete;
|
||||
|
||||
~Defer() {
|
||||
constexpr ~Defer() {
|
||||
m_deferredFunc();
|
||||
}
|
||||
|
||||
@ -34,4 +31,4 @@ class Defer {
|
||||
|
||||
}
|
||||
|
||||
#define oxDefer ox::Defer oxConcat(oxDefer_, __LINE__) = [&]
|
||||
#define oxDefer ox::Defer const oxConcat(oxDefer_, __LINE__) =
|
||||
|
Loading…
Reference in New Issue
Block a user