Revert "Fix potential memory leaks"

This commit is contained in:
Alexis Rouillard
2023-10-22 09:44:46 +02:00
committed by GitHub
parent dbb887b4a9
commit 2d33c20231
13 changed files with 29 additions and 90 deletions

View File

@ -1,21 +0,0 @@
#pragma once
#include <utility>
namespace waybar::util {
template <typename Func>
class scope_guard {
public:
explicit scope_guard(Func&& exit_function) : f{std::forward<Func>(exit_function)} {}
scope_guard(const scope_guard&) = delete;
scope_guard(scope_guard&&) = default;
scope_guard& operator=(const scope_guard&) = delete;
scope_guard& operator=(scope_guard&&) = default;
~scope_guard() { f(); }
private:
Func f;
};
} // namespace waybar::util