template<class EXIT_FUNC>
class bdlb::ScopeExit< EXIT_FUNC >
ScopeExit is a general-purpose scope proctor class template that is intended to be used as an automatic (stack) variable that calls an exit function upon its destruction (when its scope is exited).
The template argument EXIT_FUNC shall be a function object type, or a pointer to a function. If EXIT_FUNC is an object type, it shall satisfy the requirements of Destructible, Callable, and MoveConstructible as specified by the ISO C++ standard. Note that to fulfill the MoveConstructible constraint a type does not have to implement a move constructor. If it has a copy constructor, that will work fine as long at the move constructor is not deleted (or in case of C++03 emulated moves, private). The behavior is undefined if calling (the member instance of) EXIT_FUNC throws an exception (as it will be called from the destructor).
template<class EXIT_FUNC >
template<class EXIT_FUNC_PARAM >
Create a ScopeExit object, which, upon its destruction will invoke the specified function (or functor) unless its release method was called. If function is copied into the EXIT_FUNC member, and that copy throws an exception, invoke function and rethrow the exception. If EXIT_FUNC_PARAM cannot be move converted to EXIT_FUNC via no-throw means (either because such conversion does not exist or it is not marked as non-throwing), function will always be copied into the member. This constructor participates in overload resolution only if EXIT_FUNC_PARAM is neither EXIT_FUNC nor bdlb::ScopeExit<EXIT_FUNC> and EXIT_FUNC_PARAM is convertible to EXIT_FUNC. The behavior is undefined if function or the member instance of EXIT_FUNC throws an exception upon invocation.