My friend introduced me to hash tables as a way to easily associate strings with integers, and so I tried to implement them in my current project using std::unordered_map. A sample of the code is shown below (the full function is not shown for brevity, nor is the header; I am confident the problem does not reside there):
unordered_map <string,int> world::gentypetable(){
unordered_map <string,int> hashtable;
hashtable.emplace("Normal",0);
hashtable.emplace("Fire",1);
hashtable.emplace("Water",2);
hashtable.emplace("Electric",3);
hashtable.emplace("Grass",4);
However, when I try to compile this code using g++ 3.4.4-999, I receive the following error:
error: 'class std::unordered_map<std::basic_string,<char>, int>' has no member named 'emplace'
I suspect that this is because the compiler is outdated. Is that why, or is there another reason? And if it is due to the compiler, is there an alternative syntax that could be used to avoid the lengthy process of updating it to the current version?