Skip to content

Commit

Permalink
Added missed template parameter to getEvent.
Browse files Browse the repository at this point in the history
  • Loading branch information
wqking committed Dec 8, 2018
1 parent b8b6600 commit a3225c1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The same policy mechanism applies to all three classes, EventDispatcher, EventQu
**Apply**: EventDispatcher, EventQueue.

eventpp forwards all arguments of `EventDispatcher::dispatch` and `EventQueue::enqueue` (both has same arguments) to `getEvent` to get the event type, then invokes the callback list of the event type.
`getEvent` can be non-template or template function. It works as long as `getEvent` can be invoked using the same arguments as `EventDispatcher::dispatch` and `EventQueue::enqueue`.

Sample code

Expand Down
2 changes: 1 addition & 1 deletion include/eventpp/eventdispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class EventDispatcherBase <
{
static_assert(ArgumentPassingMode::canExcludeEventType, "Dispatching arguments count doesn't match required (Event type should NOT be included).");

using GetEvent = typename SelectGetEvent<Policies, EventType, HasFunctionGetEvent<Policies, Args...>::value>::Type;
using GetEvent = typename SelectGetEvent<Policies, EventType, HasFunctionGetEvent<Policies, T &&, Args...>::value>::Type;

doDispatch(
GetEvent::getEvent(std::forward<T>(first), args...),
Expand Down
2 changes: 1 addition & 1 deletion include/eventpp/eventqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class EventQueueBase <
{
static_assert(super::ArgumentPassingMode::canExcludeEventType, "Enqueuing arguments count doesn't match required (Event type should NOT be included).");

using GetEvent = typename SelectGetEvent<Policies, EventType, HasFunctionGetEvent<Policies, Args...>::value>::Type;
using GetEvent = typename SelectGetEvent<Policies, EventType, HasFunctionGetEvent<Policies, T &&, Args...>::value>::Type;

doEnqueue(QueuedEvent(
GetEvent::getEvent(std::forward<T>(first), args...),
Expand Down

0 comments on commit a3225c1

Please sign in to comment.