diff --git a/src/core/GREX.cpp b/src/core/GREX.cpp index 871fc9af0ef7108619da2e75caafb2bfbed12d9b..001b0108f600389c80a990416d756b18123b77ec 100644 --- a/src/core/GREX.cpp +++ b/src/core/GREX.cpp @@ -25,14 +25,15 @@ #include "tools/Tools.h" #include "tools/Communicator.h" #include <sstream> +#include <unordered_map> #include "GREXEnum.inc" using namespace std; namespace PLMD{ -std::map<std::string, int> & GREXWordMap(){ - static std::map<std::string, int> word_map; +const std::unordered_map<std::string, int> & GREXWordMap(){ + static std::unordered_map<std::string, int> word_map; static bool init=false; if(!init){ #include "GREXMap.inc" @@ -73,7 +74,7 @@ void GREX::cmd(const string&key,void*val){ // do nothing } else { int iword=-1; - std::map<std::string, int>::const_iterator it=GREXWordMap().find(words[0]); + auto it=GREXWordMap().find(words[0]); if(it!=GREXWordMap().end()) iword=it->second; switch(iword){ case cmd_initialized: diff --git a/src/core/PlumedMain.cpp b/src/core/PlumedMain.cpp index 007cdf8ae8a6c534fdb3792a19bf5bcd7edf8806..e391a999a4fca189677d17afa1de3712a7f10940 100644 --- a/src/core/PlumedMain.cpp +++ b/src/core/PlumedMain.cpp @@ -43,6 +43,7 @@ #include <cstdlib> #include <cstring> #include <set> +#include <unordered_map> using namespace std; @@ -50,8 +51,8 @@ using namespace std; namespace PLMD{ -std::map<std::string, int> & plumedMainWordMap(){ - static std::map<std::string, int> word_map; +const std::unordered_map<std::string, int> & plumedMainWordMap(){ + static std::unordered_map<std::string, int> word_map; static bool init=false; if(!init){ #include "PlumedMainMap.inc" @@ -127,7 +128,7 @@ void PlumedMain::cmd(const std::string & word,void*val){ } else { int iword=-1; double d; - std::map<std::string, int>::const_iterator it=plumedMainWordMap().find(words[0]); + auto it=plumedMainWordMap().find(words[0]); if(it!=plumedMainWordMap().end()) iword=it->second; switch(iword) { case cmd_setBox: