iDevGames Forums

Full Version: Using STL Map
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm considering using the STL map structure for a project but I'm not sure if I can do what I would like to do. Is it possible to use an interator and step through the map, printing out both the key and the value? I know how to easily get the value, but I'm not sure if you can get the key using an iterator or not.
std::map<K, V>::const_iterator e = my_map.end();
for (std::map<K, V>::const_iterator i = my_map.begin(); i != e; ++i) {
    K key = (*i).first;
    V value = (*i).second;
Reference URL's