mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-11 10:39:59 +00:00
Reformat all the things. Have fun with merge conflicts.
This commit is contained in:
parent
2115e8a4a6
commit
3570c7f03a
1116 changed files with 187405 additions and 180344 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue