Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
ScopeGuard.hpp
1#pragma once
2
3#include <utility>
4
5namespace util {
6
10template <typename Func>
11class ScopeGuard {
12public:
13 ScopeGuard(ScopeGuard const&) = delete;
14 ScopeGuard(ScopeGuard&&) = delete;
15 ScopeGuard&
16 operator=(ScopeGuard const&) = delete;
17 ScopeGuard&
18 operator=(ScopeGuard&&) = delete;
19
25 ScopeGuard(Func func) : func_(std::move(func))
26 {
27 }
28
30 {
31 func_();
32 }
33
34private:
35 Func func_;
36};
37
38} // namespace util
Run a function when the scope is exited.
Definition ScopeGuard.hpp:11
ScopeGuard(Func func)
Create ScopeGuard object.
Definition ScopeGuard.hpp:25
This namespace contains various utilities.
Definition AccountUtils.hpp:11