The following table shows the commonly used map APIs:
|
API |
Description |
|
at ( key ) |
This returns the value for the corresponding key if the key is found; otherwise it throws the std::out_of_range exception |
|
operator[ key ] |
This updates an existing value for the corresponding key if the key is found; otherwise it will add a new entry with the respective key=>value supplied |
|
empty() |
This returns true if the map is empty, and false otherwise |
|
size() |
This returns the count of the key=>value pairs stored in the map |
|
clear() |
This clears the entries stored in the map |
|
count() |
This returns the number of elements matching the given key |
|
find() |
This finds the element with the specified key |