diff --git a/include/scoped_guard.h b/include/scoped_guard.h index 4fdf4bfe6105003d67af54a17d6d4fd0d172a62f..1aed2882feb6a2e61b42c0c173eea6599d8fa72a 100644 --- a/include/scoped_guard.h +++ b/include/scoped_guard.h @@ -43,6 +43,7 @@ class ScopedGuard { ScopedGuard(ScopedGuard&& guard) : m_fun(guard.m_fun), m_active(true) { guard.m_active = false; + abort(); } ~ScopedGuard() @@ -54,16 +55,16 @@ class ScopedGuard { } private: - ScopedGuard(const ScopedGuard&) = delete; + explicit ScopedGuard(const ScopedGuard&) = delete; ScopedGuard& operator=(const ScopedGuard&) = delete; - const Functor& m_fun; + Functor m_fun; bool m_active; }; template <typename Functor> inline ScopedGuard<Functor> -make_scoped_guard(const Functor& guard) +make_scoped_guard(Functor guard) { return ScopedGuard<Functor>(guard); }