[wesnoth-commits] [wesnoth/wesnoth] 0571fe: GUI2: finished refactoring out usage of boost::mpl
Gregory A Lundberg
noreply at github.com
Tue Oct 13 11:19:23 UTC 2020
Branch: refs/heads/master
Home: https://github.com/wesnoth/wesnoth
Commit: 0571fefda3fa93a30f74e17a52f53a43710d4fe5
https://github.com/wesnoth/wesnoth/commit/0571fefda3fa93a30f74e17a52f53a43710d4fe5
Author: Charles Dang <exodia339 at gmail.com>
Date: 2020-10-13 (Tue, 13 Oct 2020)
Changed paths:
M src/gui/core/event/dispatcher.cpp
M src/gui/core/event/dispatcher.hpp
M src/gui/core/event/dispatcher_private.hpp
M src/gui/core/event/handler.hpp
Log Message:
-----------
GUI2: finished refactoring out usage of boost::mpl
dispatcher::has_event called the private find() function, which after a whole bunch of
jumping around essentially checked that the signal queue for the given event was not
empty. This was a run-time op, yet the code was set up using SFINAE in order to for
has_handler::oper() to call the event_signal function corresponding to the event's queue
(ie, the mouse queue for a mouse-type event).
Since this code was written before the era of constexpr, event type validation was done
using boost::mpl, which, in this case, resulted in a monstrous amalgamation of build-time
template specialization for a run-time check. I'm not certain, but I believe it might
have resulted in an specialization of find() (or at least, implementation::find()) for
every single event type (each member of the ui_event enum).
This converts the code to a purely run-time check and throws out all the template stuff.
It also removes the relevant event_signal overload dealing with events in a set. The
version dealing with function types is preserved as it's used in the fire_event()
implementation and is a fairly standard usecase of SFINAE.
The has_handler class has also been converted to a static function since it's no longer
needed for template specializations in find().
And finally, is_raw_event had to be renamed to is_raw_event_event to allow simple name
completion in IMPLEMENT_RUNTIME_EVENT_SIGNAL_CHECK. I could have also renamed the raw event
queue to signal_raw_queue but I figured keeping the name as signal_raw_event_queue made
its purpose clearer.
Commit: af323dcb9885d6d94ca9c728dfb1e3c8f29991ac
https://github.com/wesnoth/wesnoth/commit/af323dcb9885d6d94ca9c728dfb1e3c8f29991ac
Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
Date: 2020-10-13 (Tue, 13 Oct 2020)
Changed paths:
M src/gui/core/event/handler.cpp
Log Message:
-----------
More missing override specifiers.
Compare: https://github.com/wesnoth/wesnoth/compare/0069942e2aa0...af323dcb9885
More information about the Commits
mailing list