wwa-scope-action 1.0.0
Scope guard utilities for managing exit actions in C++
|
Scope guard utilities for managing exit actions. More...
#include <concepts>
#include <exception>
#include <limits>
#include <type_traits>
#include <utility>
Go to the source code of this file.
Classes | |
class | wwa::utils::exit_action< ExitFunc > |
A scope guard that calls its exit function on destruction, when a scope is exited. More... | |
class | wwa::utils::fail_action< ExitFunc > |
A scope guard that calls its exit function when a scope is exited via an exception. More... | |
class | wwa::utils::success_action< ExitFunc > |
A scope guard that calls its exit function when a scope is exited normally. More... | |
Namespaces | |
namespace | wwa |
namespace | wwa::utils |
Library namespace. | |
Functions | |
template<typename ExitFunc > | |
wwa::utils::exit_action (ExitFunc) -> exit_action< ExitFunc > | |
Deduction guide for exit_action. | |
template<typename ExitFunc > | |
wwa::utils::fail_action (ExitFunc) -> fail_action< ExitFunc > | |
Deduction guide for fail_action. | |
template<typename ExitFunc > | |
wwa::utils::success_action (ExitFunc) -> success_action< ExitFunc > | |
Deduction guide for success_action. | |
Scope guard utilities for managing exit actions.
This file provides the implementation of scope guards that execute specified actions when a scope is exited. The scope guards include:
exit_action
: Executes an action when the scope is exited.fail_action
: Executes an action when the scope is exited due to an exception.success_action
: Executes an action when the scope is exited normally.These utilities are useful for ensuring that resources are properly released or actions are taken when a scope is exited, regardless of how the exit occurs.
Examples:
Definition in file scope_action.h.