I'm trying to use a global map which is defined in a .h file like these:
const std::map<std::string, std::map<std::string, DWORD>> myMap { .. }
And then in the .cpp file I'm trying to define a global function and find values in the map like this:
bool GetValueFromMap(std::string key1, std::string key2, DWORD& val)
{
auto it = myMap.find(key1);
if(it != myMap.end())
{
auto result = it->second;
...
}
return true;
}
The problem is that the variable it has no fields at all, meaning it doesn't have anything to dereference and the compiler doesn't know what "second" is or anything related to the iterator. Why is that?
Aucun commentaire:
Enregistrer un commentaire