I have this:
unordered_map<string,string>* createDict(){
unordered_map<string,string>* Dict= new unordered_map<string,string>();
Dict["x"] = "a";
Dict["y"] = "b";
Dict["z"] = "c";
return Dict;
}
and I get the error:
expression must have integral or unscoped enum type
but this works when allocating on the stack. What is the easiest way to solve this? I really dont like having to create Pair objects to insert in to an unordered_map.
unordered_mapinstead of a pointer to one?A. You do not need a pointer member variable just because you want to dynamically allocate objects of typeA!