Skip to content

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

Member Functions

NameDescription
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

NameDescription
TResultThe result of the delegate function.
TArgsThe arguments of the delegate function.