From 787561b29afdbc78769f68c2f5c4f2cff1b32340 Mon Sep 17 00:00:00 2001 From: Vincent Robinson Date: Wed, 23 Sep 2020 10:12:20 -0700 Subject: Replace MyEventReceiver KeyList with std::unordered_set (#10419) --- src/client/keycode.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/client/keycode.h') diff --git a/src/client/keycode.h b/src/client/keycode.h index 7036705d1..263b722c7 100644 --- a/src/client/keycode.h +++ b/src/client/keycode.h @@ -24,12 +24,20 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include +class KeyPress; +namespace std +{ + template <> struct hash; +} + /* A key press, consisting of either an Irrlicht keycode or an actual char */ class KeyPress { public: + friend struct std::hash; + KeyPress() = default; KeyPress(const char *name); @@ -55,6 +63,17 @@ protected: std::string m_name = ""; }; +namespace std +{ + template <> struct hash + { + size_t operator()(const KeyPress &key) const + { + return key.Key; + } + }; +} + extern const KeyPress EscapeKey; extern const KeyPress CancelKey; -- cgit v1.2.3