17namespace jsonv::detail
20template <
typename Function>
21class scope_exit_invoker
24 explicit scope_exit_invoker(Function&& func) :
25 _func(
std::move(func)),
29 scope_exit_invoker(scope_exit_invoker&& src) :
30 _func(
std::move(src._func)),
31 _responsible(src._responsible)
33 src._responsible =
false;
36 scope_exit_invoker(
const scope_exit_invoker&) =
delete;
37 scope_exit_invoker& operator=(
const scope_exit_invoker&) =
delete;
38 scope_exit_invoker& operator=(scope_exit_invoker&&) =
delete;
56template <
typename Function>
57scope_exit_invoker<Function> on_scope_exit(Function func)
59 return scope_exit_invoker<Function>(std::move(func));
Copyright (c) 2014-2020 by Travis Gockel.