BloombergLP::bdlb::ScopeExitUtil::makeScopeExit

Return a ScopeExit guard that invokes function on destruction.

Synopsis

Declared in <bdlb_scopeexit.h>

template<class EXIT_FUNC_PARAM>
[[nodiscard]]
static
ScopeExit<bsl::decay<EXIT_FUNC_PARAM>::type>
makeScopeExit(EXIT_FUNC_PARAM&& function);

Description

Return a ScopeExit guard that uses the specified function as its exit function, and has the decayed type of function (class type or or function pointer type) as its exit function member type.

Return Value

ScopeExit guard that invokes function on destruction

NOTE

The return value should not be discarded.

Parameters

NameDescription
functionexit function or functor for the returned guard