1 #ifndef TTG_UTIL_SCOPE_EXIT_H
2 #define TTG_UTIL_SCOPE_EXIT_H
10 #include <type_traits>
13 template <
typename EF>
19 : exit_function(std::move(f))
20 , execute_on_destruction{ true }
25 : exit_function(std::move(rhs.exit_function))
26 , execute_on_destruction{ rhs.execute_on_destruction }
34 if (execute_on_destruction) this->exit_function();
39 this->execute_on_destruction =
false;
47 bool execute_on_destruction;
50 template <
typename EF>
auto make_scope_exit(EF &&exit_function)
scope_exit(scope_exit &&rhs)