I have a map of elements that I would like to iterate through. Of course, the standard way to do that would be using a for loop with
for (map<string, int> iterator it = myMap.begin(); it != myMap.end(); ++it) {
string thisKey = it->first;
int thisValue = it->second;
}
but if I try and make this loop run parallel using OpenMP's parallel for construct, it doesn't work, and this is (apparently) a known issue, as it doesn't recognize this sort of loop construct.
So, my backup plan was to use an integer index iterator, and access the list of keys and values by index, as I would do in C# like so:
for (int i = 0; i < myMap.Count; ++i) {
string thisKey = myMap.Keys[i];
string thisValue = myMap.Values[i];
}
... yet I can't seem to find an equivalent method in C++. Is there a way to do this in C++ that I'm unaware of?