25#ifndef TGUI_SCOPE_EXIT_HPP
26#define TGUI_SCOPE_EXIT_HPP
28#include <TGUI/Config.hpp>
42 template <typename G, typename = typename std::enable_if<!std::is_same_v<typename std::decay<G>::type, ScopeExit>>::type>
43 explicit ScopeExit(G&& func) :
44 m_func(std::forward<G>(func)),
49 ScopeExit(
const ScopeExit&) =
delete;
51 ScopeExit& operator=(
const ScopeExit&) =
delete;
52 ScopeExit& operator=(ScopeExit&&) =
delete;
54 ScopeExit(ScopeExit&& other)
noexcept(std::is_nothrow_move_constructible_v<F>) :
55 m_func(std::move(other.m_func)),
56 m_active(other.m_active)
58 other.m_active =
false;
Invokes a function when leaving scope (return or exception). Not included from TGUI....
Definition ScopeExit.hpp:40
void release() noexcept
Skip invoking the function when the guard is destroyed.
Definition ScopeExit.hpp:70
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:37
ScopeExit< typename std::decay< F >::type > makeScopeExit(F &&func)
Helper to create a ScopeExit without naming the lambda's type.
Definition ScopeExit.hpp:84