26 template<
typename Handle, Handle inval
id,
typename Deleter>
32 CScopeGuard(std::function<Deleter> del, Handle handle = invalid)
42 operator Handle()
const 49 return m_handle != invalid;
79 if (m_handle != invalid)
93 : m_handle{std::move(rhs.m_handle)}, m_deleter{std::move(rhs.m_deleter)}
101 m_deleter = std::move(rhs.m_deleter);
107 std::function<Deleter> m_deleter;
void reset()
reset the instance, closing any managed handle and setting it to invalid
Definition: ScopeGuard.h:77
Definition: ColorUtils.h:18
Definition: AudioDecoder.h:18
Generic scopeguard designed to handle any type of handle.
Definition: ScopeGuard.h:27
void attach(Handle handle)
attach a new handle to this instance, if there's already a handle it will be closed.
Definition: ScopeGuard.h:57
Handle release()
release the managed handle so that it won't be auto closed
Definition: ScopeGuard.h:68