RAII scope guard — calls fn on destruction unless dismissed.
More...
Public Member Functions | |
| auto | active () const noexcept -> bool |
| Check if the guard is active. | |
| auto | dismiss () noexcept -> void |
| Dismiss — disarm the guard (cleanup will NOT run). | |
| 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. | |
RAII scope guard — calls fn on destruction unless dismissed.
| Fn | Callable type (typically a lambda). |