diff --git a/docs/md/signal.md b/docs/md/signal.md index 899fc7aa7..d074cd753 100644 --- a/docs/md/signal.md +++ b/docs/md/signal.md @@ -387,9 +387,9 @@ entt::dispatcher dispatcher{}; ``` In order to register an instance of a class to a dispatcher, its type must -expose one or more member functions the arguments of which are such that -`const E &` can be converted to them for each type of event `E`, no matter what -the return value is.
+expose one or more member functions the arguments of which are such that `E &` +can be converted to them for each type of event `E`, no matter what the return +value is.
The name of the member function aimed to receive the event must be provided to the `connect` member function of the sink in charge for the specific event: diff --git a/src/entt/signal/dispatcher.hpp b/src/entt/signal/dispatcher.hpp index 909483caf..33a43d558 100644 --- a/src/entt/signal/dispatcher.hpp +++ b/src/entt/signal/dispatcher.hpp @@ -23,7 +23,7 @@ namespace entt { * events to be published all together once per tick.
* Listeners are provided in the form of member functions. For each event of * type `Event`, listeners are such that they can be invoked with an argument of - * type `const Event &`, no matter what the return type is. + * type `Event &`, no matter what the return type is. * * The dispatcher creates instances of the `sigh` class internally. Refer to the * documentation of the latter for more details. @@ -39,7 +39,7 @@ class dispatcher { template struct pool_handler final: basic_pool { - using signal_type = sigh; + using signal_type = sigh; using sink_type = typename signal_type::sink_type; void publish() override { @@ -66,7 +66,8 @@ class dispatcher { template void trigger(Args &&... args) { - signal.publish(Event{std::forward(args)...}); + Event instance{std::forward(args)...}; + signal.publish(instance); } template @@ -115,9 +116,9 @@ public: * * A sink is an opaque object used to connect listeners to events. * - * The function type for a listener is: + * The function type for a listener is _compatible_ with: * @code{.cpp} - * void(const Event &); + * void(Event &); * @endcode * * The order of invocation of the listeners isn't guaranteed. diff --git a/test/entt/signal/dispatcher.cpp b/test/entt/signal/dispatcher.cpp index 071547bc5..3a24e8d55 100644 --- a/test/entt/signal/dispatcher.cpp +++ b/test/entt/signal/dispatcher.cpp @@ -8,7 +8,7 @@ struct another_event {}; struct one_more_event {}; struct receiver { - static void forward(entt::dispatcher &dispatcher, const an_event &event) { + static void forward(entt::dispatcher &dispatcher, an_event &event) { dispatcher.enqueue(event); }