|
JNGL
Easy to use cross-platform 2D game library
|
Helper class which calls a function when being destroyed. More...
#include <jngl/Finally.hpp>
Public Member Functions | |
| Finally (std::function< void()> functionToCall) | |
| functionToCall will be moved into the member with the same name | |
| Finally (Finally &&) noexcept | |
| The moved-from Finally object will no longer call the function. | |
| Finally & | operator= (Finally &&) noexcept |
| The moved-from Finally object will no longer call the function. | |
| Finally (const Finally &)=delete | |
| Finally & | operator= (const Finally &)=delete |
| ~Finally () | |
| Calls the function which has been passed into the constructor. | |
Helper class which calls a function when being destroyed.
Useful when using C interfaces without the need to write a wrapper class. For example:
Definition at line 22 of file Finally.hpp.
|
explicit |
functionToCall will be moved into the member with the same name
You can pass nullptr to do nothing.