<<< Adding items to a map | Index | map iterators >>> |
Use count( key ) to see if key is in the map
For a map, count( ) will always return 0 or 1
map< string, int > agemap; string name = "fred"; int age = agemap[ name ]; // Always succeeds, might return 0 if ( agemap.count(name) == 0 ) { // name is not in map }
<<< Adding items to a map | Index | map iterators >>> |