veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
finalizer.hpp
1// Copyright (c) 2019-2022 Xenios SEZC
2// https://www.veriblock.org
3// Distributed under the MIT software license, see the accompanying
4// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef ALT_INTEGRATION_INCLUDE_VERIBLOCK_FINALIZER_HPP_
7#define ALT_INTEGRATION_INCLUDE_VERIBLOCK_FINALIZER_HPP_
8
9#include <functional>
10
11namespace altintegration {
12
18struct Finalizer {
19 explicit Finalizer(std::function<void()> func) : onDestroy(std::move(func)) {}
20 ~Finalizer() { onDestroy(); }
21
22 private:
23 std::function<void()> onDestroy;
24};
25
26} // namespace altintegration
27
28#endif // ALT_INTEGRATION_INCLUDE_VERIBLOCK_FINALIZER_HPP_
Defines logging helpers.
Definition: block.hpp:14
Finalizer holds a function that is executed on Finalizer destruction.
Definition: finalizer.hpp:18