Tensor Comprehensions
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
scope_guard.h
Go to the documentation of this file.
1
16
#pragma once
17
18
#include <functional>
19
20
namespace
tc {
21
22
//
23
// Poor man's ScopeGuard
24
//
25
class
ScopeGuard
{
26
std::function<void()>
onExit
;
27
ScopeGuard
() =
delete
;
28
ScopeGuard
(
ScopeGuard
&) =
delete
;
29
ScopeGuard
(
ScopeGuard
&&) =
delete
;
30
ScopeGuard
operator=
(
ScopeGuard
&) =
delete
;
31
ScopeGuard
operator=
(
ScopeGuard
&&) =
delete
;
32
33
public
:
34
template
<
class
F>
35
ScopeGuard
(
const
F& f) :
onExit
(f) {}
36
~ScopeGuard
() noexcept(false) {
37
onExit
();
38
}
39
};
40
41
}
// namespace tc
tc::ScopeGuard::~ScopeGuard
~ScopeGuard() noexcept(false)
Definition:
scope_guard.h:36
tc::ScopeGuard
Definition:
scope_guard.h:25
tc::ScopeGuard::ScopeGuard
ScopeGuard()=delete
tc::ScopeGuard::onExit
std::function< void()> onExit
Definition:
scope_guard.h:26
tc::ScopeGuard::operator=
ScopeGuard operator=(ScopeGuard &)=delete
tc::ScopeGuard::ScopeGuard
ScopeGuard(const F &f)
Definition:
scope_guard.h:35
include
tc
core
scope_guard.h
Generated by
1.8.5