keycode.cpp: use std::unordered_map for keypress cache
authorLoic Blot <loic.blot@unix-experience.fr>
Thu, 21 Sep 2017 16:47:42 +0000 (18:47 +0200)
committerLoic Blot <loic.blot@unix-experience.fr>
Thu, 21 Sep 2017 16:47:42 +0000 (18:47 +0200)
src/keycode.cpp

index cedd0803bef841adb097a0302a6516347e28f446..6822875b1bce0017954a77e2542b669161348953 100644 (file)
@@ -359,13 +359,13 @@ const KeyPress CancelKey("KEY_CANCEL");
 */
 
 // A simple cache for quicker lookup
-std::map<std::string, KeyPress> g_key_setting_cache;
+std::unordered_map<std::string, KeyPress> g_key_setting_cache;
 
 KeyPress getKeySetting(const char *settingname)
 {
-       std::map<std::string, KeyPress>::iterator n;
+       std::unordered_map<std::string, KeyPress>::iterator n;
        n = g_key_setting_cache.find(settingname);
-       if(n != g_key_setting_cache.end())
+       if (n != g_key_setting_cache.end())
                return n->second;
 
        KeyPress k(g_settings->get(settingname).c_str());