|
| delegate () ENTT_NOEXCEPT |
| Default constructor.
|
|
template<auto Candidate> |
| delegate (connect_arg_t< Candidate >) ENTT_NOEXCEPT |
| Constructs a delegate and connects a free function or an unbound member. More...
|
|
template<auto Candidate, typename Type > |
| delegate (connect_arg_t< Candidate >, Type &&value_or_instance) ENTT_NOEXCEPT |
| Constructs a delegate and connects a free function with payload or a bound member. More...
|
|
| delegate (function_type *function, const void *payload=nullptr) ENTT_NOEXCEPT |
| Constructs a delegate and connects an user defined function with optional payload. More...
|
|
template<auto Candidate> |
void | connect () ENTT_NOEXCEPT |
| Connects a free function or an unbound member to a delegate. More...
|
|
template<auto Candidate, typename Type > |
void | connect (Type &value_or_instance) ENTT_NOEXCEPT |
| Connects a free function with payload or a bound member to a delegate. More...
|
|
template<auto Candidate, typename Type > |
void | connect (Type *value_or_instance) ENTT_NOEXCEPT |
| Connects a free function with payload or a bound member to a delegate. More...
|
|
void | connect (function_type *function, const void *payload=nullptr) ENTT_NOEXCEPT |
| Connects an user defined function with optional payload to a delegate. More...
|
|
void | reset () ENTT_NOEXCEPT |
| Resets a delegate. More...
|
|
const void * | instance () const ENTT_NOEXCEPT |
| Returns the instance or the payload linked to a delegate, if any. More...
|
|
Ret | operator() (Args... args) const |
| Triggers a delegate. More...
|
|
| operator bool () const ENTT_NOEXCEPT |
| Checks whether a delegate actually stores a listener. More...
|
|
bool | operator== (const delegate< Ret(Args...)> &other) const ENTT_NOEXCEPT |
| Compares the contents of two delegates. More...
|
|
template<typename Ret, typename... Args>
class entt::delegate< Ret(Args...)>
Utility class to use to send around functions and members.
Unmanaged delegate for function pointers and members. Users of this class are in charge of disconnecting instances before deleting them.
A delegate can be used as a general purpose invoker without memory overhead for free functions possibly with payloads and bound or unbound members.
- Template Parameters
-
Ret | Return type of a function type. |
Args | Types of arguments of a function type. |
template<typename Ret , typename... Args>
template<auto Candidate, typename Type >
void entt::delegate< Ret(Args...)>::connect |
( |
Type & |
value_or_instance | ) |
|
|
inline |
Connects a free function with payload or a bound member to a delegate.
The delegate isn't responsible for the connected object or the payload. Users must always guarantee that the lifetime of the instance overcomes the one of the delegate.
When used to connect a free function with payload, its signature must be such that the instance is the first argument before the ones used to define the delegate itself.
- Template Parameters
-
Candidate | Function or member to connect to the delegate. |
Type | Type of class or type of payload. |
- Parameters
-
value_or_instance | A valid reference that fits the purpose. |