LiteFX::Delegate¶
Represents a handler for an Event, that is assigned a unique token when created, so that it can be identified later.
Synopsis¶
Declared in <litefx/app.hpp>
template<
typename TResult,
typename... TArgs>
class Delegate final
Description¶
Since a std::function or callable is non-comparable, it is not possible to identify and remove event handlers from an event, after registering them. To support this functionality, the event handler will be encapsulated in a delegate, which gets assigned with a token. This token is unique for the event, the delegate has been registered to.
Type Aliases¶
| Name |
|---|
function_type |
token_type |
Member Functions¶
| Name | Description |
|---|---|
Delegate [constructor] | Creates a new delegate. |
invoke | Invokes the delegate function. |
operator() | Invokes the delegate function. |
token | Returns the unique token of the delegate. |
Template Parameters¶
| Name | Description |
|---|---|
| TResult | The result of the delegate function. |
| TArgs | The arguments of the delegate function. |