cheatah
Class

builtins::Finally

Runs its action when the scope ends, however it ends — the body of a finally.

Functions

fn Finally · 2 overloads
Finally(F f)source#
Finally(const Finally &)=deletesource#

Take ownership of the action to run at scope exit.

Parameters
f

the callable to invoke from the destructor.

Complexity

O(1).

Allocation

moves f into the guard.

fn Finally & operator=(const Finally &)=delete source#
fn ~Finally() source#

Run the action.

Reached on every exit path — normal fall-through, return, break, or an exception unwinding through the scope, which is the whole point of a guard over a duplicated block.

Complexity

that of the action.

Allocation

that of the action.

Constants & variables

var F f_ source#