Plasma Engine
2.0
Loading...
Searching...
No Matches
ScopeExit.h
1
2
#pragma once
3
4
#include <Foundation/Basics.h>
5
7
9
#define PL_SCOPE_EXIT(code) auto PL_PP_CONCAT(scopeExit_, PL_SOURCE_LINE) = plMakeScopeExit([&]() { code; })
10
12
template
<
typename
T>
13
struct
plScopeExit
14
{
15
PL_ALWAYS_INLINE
plScopeExit
(T&& func)
16
: m_func(std::forward<T>(func))
17
{
18
}
19
20
PL_ALWAYS_INLINE
~plScopeExit
() { m_func(); }
21
22
T m_func;
23
};
24
26
template
<
typename
T>
27
PL_ALWAYS_INLINE
plScopeExit<T>
plMakeScopeExit(T&& func)
28
{
29
return
plScopeExit<T>
(std::forward<T>(func));
30
}
plScopeExit
Definition
ScopeExit.h:14
Code
Engine
Foundation
Types
ScopeExit.h
Generated by
1.11.0