14 scope_exit(const scope_exit&);
15 scope_exit& operator=(const scope_exit&);
19 explicit scope_exit(T2&& func)
20 : func_(std::forward<T2>(func))
25 scope_exit(scope_exit&& other)
26 : func_(std::move(other.func_))
27 , valid_(std::move(other.valid_))
32 scope_exit& operator=(scope_exit&& other)
34 func_ = std::move(other.func_);
35 valid_ = std::move(other.valid_);
51 if(!std::uncaught_exception())
54 CASPAR_LOG_CURRENT_EXCEPTION();
62 class scope_exit_helper {};
65 scope_exit<typename std::decay<T>::type> operator+(scope_exit_helper, T&& exitScope)
67 return scope_exit<typename std::decay<T>::type>(std::forward<T>(exitScope));
71 #define _CASPAR_EXIT_SCOPE_LINENAME_CAT(name, line) name##line
72 #define _CASPAR_EXIT_SCOPE_LINENAME(name, line) _CASPAR_EXIT_SCOPE_LINENAME_CAT(name, line)
73 #define CASPAR_SCOPE_EXIT auto _CASPAR_EXIT_SCOPE_LINENAME(EXIT, __LINE__) = ::caspar::detail::scope_exit_helper() + [&]() mutable