template<typename CallbackClass>
class ola::CallbackRunner< CallbackClass >
Automatically execute a callback when it goes out of scope.
- Template Parameters
-
CallbackClass | An class which has a Run() method. |
This is useful if the function or method has multiple return points and you need to ensure that the callback is always executed before the function returns. It's most useful for handling RPCs.
- Example
int Foo(MyCallback *callback) {
if (...) {
return 1;
} else {
if (...) {
return 2;
} else {
return 3;
}
}
}