Class EventDispatcher#

Class Documentation#

class EventDispatcher#

Dispatcher for events.

Public Functions

explicit constexpr EventDispatcher(Event &event) noexcept#

Constructor.

Note

The event must outlive the event dispatcher!

Parameters:

eventEvent to dispatch.

constexpr ~EventDispatcher() = default#

Destructor.

constexpr EventDispatcher(const EventDispatcher&) noexcept = default#

Copy constructor.

constexpr EventDispatcher &operator=(const EventDispatcher&) noexcept = default#

Copy assignment operator.

constexpr EventDispatcher(EventDispatcher&&) noexcept = default#

Move constructor.

constexpr EventDispatcher &operator=(EventDispatcher&&) noexcept = default#

Move assignment operator.

template<typename T, typename F>
constexpr bool Dispatch(F &&func) const & noexcept#

Dispatch a specific event to a function.

Template Parameters:
  • TEvent to dispatch.

  • F – Function to call.

Parameters:

func – Function to call.

Returns:

True if the received event matches the event to dispatch, false otherwise.

template<typename T, typename F>
constexpr bool Dispatch(F &&func) const && noexcept#

Dispatch a specific event to a function.

Template Parameters:
  • TEvent to dispatch.

  • F – Function to call.

Parameters:

func – Function to call.

Returns:

True if the received event matches the event to dispatch, false otherwise.

template<typename T, typename F>
constexpr bool Dispatch(F &&func) const & noexcept
template<typename T, typename F>
constexpr bool Dispatch(F &&func) const && noexcept