JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
jngl
Finally.hpp
Go to the documentation of this file.
1
// Copyright 2007-2024 Jan Niklas Hasse <jhasse@bixense.com>
2
// For conditions of distribution and use, see copyright notice in LICENSE.txt
5
#pragma once
6
7
#include <
functional
>
8
9
namespace
jngl
{
10
22
class
Finally
{
23
public
:
27
explicit
Finally
(
std::function
<
void
()> functionToCall);
28
30
Finally
(
Finally
&&) noexcept;
31
33
Finally
& operator=(
Finally
&&) noexcept;
34
35
Finally
(const
Finally
&) = delete;
36
Finally
& operator=(const
Finally
&) = delete;
37
39
~
Finally
();
40
41
private:
42
std
::function<
void
()> functionToCall;
43
};
44
45
}
// namespace jngl
jngl::Finally
Helper class which calls a function when being destroyed.
Definition
Finally.hpp:22
jngl::Finally::Finally
Finally(Finally &&) noexcept
The moved-from Finally object will no longer call the function.
jngl::Finally::Finally
Finally(std::function< void()> functionToCall)
functionToCall will be moved into the member with the same name
std::function
functional
jngl
JNGL's main namespace.
Definition
Achievement.hpp:10
std