mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Reformat all the things. Have fun with merge conflicts.
This commit is contained in:
@ -8,43 +8,36 @@
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
class ScopeGuard final
|
||||
{
|
||||
public:
|
||||
template<class Callable>
|
||||
ScopeGuard(Callable&& finalizer) : m_finalizer(std::forward<Callable>(finalizer)) {}
|
||||
template <class Callable>
|
||||
ScopeGuard(Callable&& finalizer) : m_finalizer(std::forward<Callable>(finalizer))
|
||||
{
|
||||
}
|
||||
|
||||
ScopeGuard(ScopeGuard&& other) : m_finalizer(std::move(other.m_finalizer))
|
||||
{
|
||||
other.m_finalizer = nullptr;
|
||||
}
|
||||
ScopeGuard(ScopeGuard&& other) : m_finalizer(std::move(other.m_finalizer))
|
||||
{
|
||||
other.m_finalizer = nullptr;
|
||||
}
|
||||
|
||||
~ScopeGuard()
|
||||
{
|
||||
Exit();
|
||||
}
|
||||
~ScopeGuard() { Exit(); }
|
||||
void Dismiss() { m_finalizer = nullptr; }
|
||||
void Exit()
|
||||
{
|
||||
if (m_finalizer)
|
||||
{
|
||||
m_finalizer(); // must not throw
|
||||
m_finalizer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Dismiss()
|
||||
{
|
||||
m_finalizer = nullptr;
|
||||
}
|
||||
ScopeGuard(const ScopeGuard&) = delete;
|
||||
|
||||
void Exit()
|
||||
{
|
||||
if (m_finalizer)
|
||||
{
|
||||
m_finalizer(); // must not throw
|
||||
m_finalizer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ScopeGuard(const ScopeGuard&) = delete;
|
||||
|
||||
void operator=(const ScopeGuard&) = delete;
|
||||
void operator=(const ScopeGuard&) = delete;
|
||||
|
||||
private:
|
||||
std::function<void()> m_finalizer;
|
||||
std::function<void()> m_finalizer;
|
||||
};
|
||||
|
||||
} // Namespace Common
|
||||
|
Reference in New Issue
Block a user