I am using the Map type from the Stanford libraries. And I can easily get values, by passing it .get(key) But it occurred to me that it would be beneficial if I could retrieve it´s keys as-well. Is there a way of doing this?
According to it´s doc at: http://www.stanford.edu/class/cs106b/materials/cppdoc/Map-class.html it does not have such functions. But is there another way of doing it?
Maybe using an iterator: Map <string, int>::iterator ?
Yes, there is. Try
foreach: