Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <functional>
- class defer {
- public:
- defer(std::function<void()> teardown)
- : _teardown(teardown) {}
- ~defer() {
- this->_teardown();
- }
- private:
- std::function<void()> _teardown;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement