The ScopeOutAction class - guard-type class that allows points callback that will be called at the scope out.
More...
#include <avutils.h>
|
| template<typename Proc> |
| | ScopeOutAction (const Proc &proc) |
| | Run a callback when the guard leaves scope.
|
| template<typename Proc> |
| | ScopeOutAction (Proc &&proc) |
| | Run a callback when the guard leaves scope, moving it in.
|
Example:
void foo()
{
int fd = open(...some args...);
close(fd);
});
try
{
}
catch(...)
{
throw;
}
}
ScopeOutAction(const Proc &proc)
Run a callback when the guard leaves scope.
Definition avutils.h:479
In example above dtor of the action will be called before fd and we correctly close descriptor.
◆ ScopeOutAction() [1/2]
template<typename Proc>
| av::ScopeOutAction::ScopeOutAction |
( |
const Proc & | proc | ) |
|
|
inline |
- Template Parameters
-
- Parameters
-
| proc | the callback to invoke; it is copied into the guard |
◆ ScopeOutAction() [2/2]
template<typename Proc>
| av::ScopeOutAction::ScopeOutAction |
( |
Proc && | proc | ) |
|
|
inline |
- Template Parameters
-
- Parameters
-
| proc | the callback to invoke; it is moved into the guard |
The documentation for this class was generated from the following file: