The Gaudi Framework
v30r3 (a5ef0a68)
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
finally.h
Go to the documentation of this file.
1
#include <utility>
2
//
3
// make it possible to execute an action at the exit of a scope
4
//
5
// auto f = finally( [](){ std::cout << "end of scope!" << std::endl; } );
6
//
7
// the above will execute the provided callable when f goes out of scope,
8
// i.e. the 'current' scope ends.
9
10
template
<
typename
F>
11
struct
final_action
{
12
F
act
;
13
final_action
(
final_action
&& ) =
default
;
14
~final_action
() {
act
(); }
15
};
16
17
template
<
typename
F>
18
final_action<F>
finally
( F&&
act
)
19
{
20
return
{std::forward<F>(
act
)};
21
}
final_action
Definition:
finally.h:11
final_action::~final_action
~final_action()
Definition:
finally.h:14
final_action::act
F act
Definition:
finally.h:12
final_action::final_action
final_action(final_action &&)=default
GaudiKernel
GaudiKernel
finally.h
Generated on Wed Aug 1 2018 23:21:02 for The Gaudi Framework by
1.8.11