mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 21:35:45 +02:00
Store a function (or closure) in an instance and invoke the function from the destructor. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
19 lines
263 B
C++
19 lines
263 B
C++
#ifndef CRUCIBLE_CLEANUP_H
|
|
#define CRUCIBLE_CLEANUP_H
|
|
|
|
#include <functional>
|
|
|
|
namespace crucible {
|
|
using namespace std;
|
|
|
|
class Cleanup {
|
|
function<void()> m_cleaner;
|
|
public:
|
|
Cleanup(function<void()> func);
|
|
~Cleanup();
|
|
};
|
|
|
|
}
|
|
|
|
#endif // CRUCIBLE_CLEANUP_H
|