JNGL
Finally.hpp
Go to the documentation of this file.
1 // Copyright 2007-2019 Jan Niklas Hasse <[email protected]>
2 // For conditions of distribution and use, see copyright notice in LICENSE.txt
4 #pragma once
5 
6 #include <functional>
7 
8 namespace jngl {
9 
11 class Finally {
12 public:
13  explicit Finally(std::function<void()> functionToCall);
14  Finally(Finally&&) noexcept;
15  Finally& operator=(Finally&&) noexcept;
16  Finally(const Finally&) = delete;
17  Finally& operator=(const Finally&) = delete;
18  ~Finally();
19 
20 private:
21  std::function<void()> functionToCall;
22 };
23 
24 } // namespace jngl
jngl::Finally
Helper class which calls a function when being destroyed.
Definition: Finally.hpp:11
functional
std::function
jngl
JNGL's main namespace.
Definition: App.hpp:9