About
A maxon::Delegate is used to define a callback function.
Declaration
A function that provides the callback simply defines a maxon::Delegate argument. The maxon::Delegate class template defines both the return value and argument types of the callback functions.
Definition: delegate.h:240
bool Bool
boolean type, possible values are only false/true, 8 bit
Definition: apibase.h:181
int32_t Int32
32 bit signed integer datatype.
Definition: apibase.h:176
maxon::ValueReceiver is a template for a generic delegate function.
Invocation
Within a function the maxon::Delegate argument can be used like an ordinary function pointer.
{
{
return;
}
}
Py_ssize_t i
Definition: abstract.h:645
Py_UCS4 * res
Definition: unicodeobject.h:1113
Usage
There are multiple ways to define the actual callback. It is possible to define the lambda directly, use a lambda object, use a maxon::Delegate object or just use a simple function pointer.
- Note
- A delegate can be defined using a lambda function. This lambda function must not use data that can only be moved. This is because at some point the delegate object might be copied.
{
return false;
return true;
});
{
return false;
return true;
};
LongRunningTask(lambda);
LongRunningTask(maxonDelegate);
LongRunningTask(SomeFunction);
unsigned char * p
Definition: floatobject.h:87
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
Further Reading