Class for executing a function upon scope exit.
More...
#include <pibase.h>
|
|
| PIScopeExitCall (std::function< void()> f) |
| | Constructor that takes a function to execute.
|
| |
|
| ~PIScopeExitCall () |
| | Destructor that executes the function if it exists.
|
| |
|
void | cancel () |
| | Method for canceling the function.
|
| |
|
void | call () |
| | Method for call the function.
|
| |
|
void | callAndCancel () |
| | Method for call and canceling the function.
|
| |
Class for executing a function upon scope exit.
Example
bool yourFunc() {
...
if (!good0) {
...
return false;
}
if (!good1) {
...
return false;
}
...
return true;
}
Class for executing a function upon scope exit.
Definition: pibase.h:686
void cancel()
Method for canceling the function.
Definition: pibase.h:701
#define piCout
Macro used for conditional (piDebug) output to PICout(StdOut)
Definition: picout.h:35
In this example "Error!" will be printed on every false function return.