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;
}
...
error_call.cancel();
return true;
}
PIScopeExitCall(std::function< void()> f)
Constructor that takes a function to execute.
Definition pibase.h:735
#define piCout
Macro used for conditional (piDebug) output to PICout(StdOut).
Definition picout.h:36
In this example "Error!" will be printed on every false function return.