legate::ScopeFail#
-
template<typename F>
class ScopeFail# Similar to ScopeGuard, except that the callable is only executed if the scope is exited due to an exception.
- Template Parameters:
F – The type of the callable to execute.
Public Functions
-
explicit ScopeFail(value_type &&fn) noexcept#
Construct a ScopeFail.
On destruction, a ScopeFail will execute
fn
if and only if the scope is being exited due to an uncaught exception. Therefore, unlike ScopeGuard, it is not possible to “disable” a ScopeFail.fn
will be invoked with no arguments, and any return value discarded.fn
must be no-throw move-constructible, and must not throw any exceptions when invoked.See also
- Parameters:
fn – The function to execute.