Reformat all the things. Have fun with merge conflicts.

This commit is contained in:
Pierre Bourdon
2016-06-24 10:43:46 +02:00
parent 2115e8a4a6
commit 3570c7f03a
1116 changed files with 187405 additions and 180344 deletions

View File

@ -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