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-2021 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
:
25
explicit
Finally
(
std::function
<
void
()> functionToCall);
26
28
Finally
(
Finally
&&) noexcept;
29
31
Finally
& operator=(
Finally
&&) noexcept;
32
33
Finally
(const
Finally
&) = delete;
34
Finally
& operator=(const
Finally
&) = delete;
35
37
~
Finally
();
38
39
private:
40
std
::function<
void
()> functionToCall;
41
};
42
43
}
// 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