magpie/utils/finalaction.h

23 lines
524 B
C
Raw Permalink Normal View History

// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <functional>
class FinalAction {
public:
FinalAction(const std::function<void()>& action);
~FinalAction();
FinalAction() = delete;
FinalAction(const FinalAction&) = delete;
FinalAction(FinalAction&&) = delete;
FinalAction& operator = (const FinalAction&) = delete;
FinalAction& operator = (FinalAction&&) = delete;
private:
std::function<void()> action;
};