scopeGuard

fnauto scopeGuard(alias fn)()

Creates a scope guard that calls the given delegate on scope exit.

Parameters

fnThe cleanup function to call

Returns

A ScopeGuard that will call fn when destroyed