ZXFoundation™ 26h2
Loading...
Searching...
No Matches
lib.scope_guard Module Reference

Data Structures

class  lib::scope_guard< Fn >
 RAII scope guard — calls fn on destruction unless dismissed. More...

Functions

auto active () const noexcept -> bool
 Check if the guard is active.
auto dismiss () noexcept -> void
 Dismiss — disarm the guard (cleanup will NOT run).
template<typename Fn>
auto lib::make_scope_guard (Fn &&fn) noexcept -> scope_guard< Fn >
 Factory function — deduces Fn from the argument.
auto operator= (const scope_guard &)=delete
auto operator= (scope_guard &&)=delete
auto rearm () noexcept -> void
 Re-arm a dismissed guard.
 scope_guard (const scope_guard &)=delete
 scope_guard (Fn fn) noexcept
 Construct a scope guard with the given cleanup function.
 scope_guard (scope_guard &&other) noexcept
 Move constructor — transfers ownership.
 ~scope_guard () noexcept
 Destructor — executes the cleanup if still active.

Files

file  lib/scope_guard.cxxm
 RAII scope guard — executes a cleanup callback on scope exit.