ChimeraTK-cppext
01.05.02
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
Functions
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
a
b
c
d
e
f
g
h
i
m
n
o
p
q
r
s
t
u
v
w
~
Functions
a
b
c
d
e
f
g
h
i
m
o
p
r
s
t
u
v
w
~
Variables
b
c
d
e
h
i
n
q
r
s
u
v
w
Typedefs
Related Symbols
Files
File List
File Members
All
b
m
n
q
s
Functions
b
m
s
Variables
Macros
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Friends
Macros
Pages
Loading...
Searching...
No Matches
finally.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2
// SPDX-License-Identifier: LGPL-3.0-or-later
3
#pragma once
4
5
#include <utility>
6
7
// Taken from GSL library, https://github.com/Microsoft/GSL/blob/master/include/gsl/gsl_util
8
// Original Licence: MIT
9
10
namespace
cppext
{
11
12
template
<
class
F>
13
class
final_act
{
14
public
:
15
explicit
final_act
(F f) noexcept : f_(std::move(f)), invoke_(
true
) {}
16
17
final_act
(
final_act
&& other) noexcept : f_(std::move(other.f_)), invoke_(other.invoke_) { other.invoke_ =
false
; }
18
19
final_act
(
const
final_act
&) =
delete
;
20
final_act
&
operator=
(
const
final_act
&) =
delete
;
21
22
~final_act
() noexcept {
23
if
(invoke_) f_();
24
}
22
~final_act
() noexcept {
…
}
25
26
private
:
27
F f_;
28
bool
invoke_;
29
};
13
class
final_act
{
…
};
30
31
template
<
class
F>
32
inline
final_act<F>
finally
(
const
F& f)
noexcept
{
33
return
final_act<F>
(
f
);
34
}
32
inline
final_act<F>
finally
(
const
F& f)
noexcept
{
…
}
35
36
template
<
class
F>
37
inline
final_act<F>
finally
(
F
&&
f
)
noexcept
{
38
return
final_act<F>
(std::forward<F>(
f
));
39
}
37
inline
final_act<F>
finally
(
F
&&
f
)
noexcept
{
…
}
40
41
}
// namespace cppext
cppext::final_act
Definition
finally.hpp:13
cppext::final_act::operator=
final_act & operator=(const final_act &)=delete
cppext::final_act::~final_act
~final_act() noexcept
Definition
finally.hpp:22
cppext::final_act::final_act
final_act(final_act &&other) noexcept
Definition
finally.hpp:17
cppext::final_act::final_act
final_act(const final_act &)=delete
cppext::final_act::final_act
final_act(F f) noexcept
Definition
finally.hpp:15
cppext
Definition
barrier.hpp:9
sources
ChimeraTK-cppext
include
finally.hpp
Generated by
1.9.8