Base module
PolymorphicDelegate
Polymorphic function delegate.
PolymorphicDelegate
#include <icy/delegate.h>Inherits:
AbstractDelegate< RT, IT & >
Polymorphic function delegate.
Theis class contains a pointer to a class member that receices a derived subclass (PT) of the base type specified by the IT param.
Public Attributes
instance
Class * instancemethod
RT(Class::* methodPublic Methods
| Return | Name | Description |
|---|---|---|
PolymorphicDelegate inline | #### Parameters | |
RT | operator() virtual const inline | Attempts to cast object to PT; invokes the method if successful. Returns a default-constructed RT if the cast fails (packet type mismatch). |
bool | operator== virtual const inline | #### Parameters |
PolymorphicDelegate
inline
inline PolymorphicDelegate(Class * instance, RT(Class::*)(PT &) method)Parameters
instanceObject on which to invoke the member function.methodPointer to the member function accepting a derivedPT&.
operator()
virtual const inline
virtual inline RT operator()(IT & object) constAttempts to cast object to PT; invokes the method if successful. Returns a default-constructed RT if the cast fails (packet type mismatch).
Parameters
objectBase-type reference; cast toPTbefore dispatch.
Returns
Method result, or default RT on cast failure.
operator==
virtual const inline
virtual inline bool operator==(const AbstractDelegate< RT, IT & > & that) constParameters
thatOther delegate to compare.
Returns
True if both delegates wrap the same instance/method pair.
