Description
map is an associative container structure, that stores (key,value) pairs for later lookup based on the key. The map is kept sorted according to the ascending order of its keys.
Declaration
template <class Key, class T, class Cmp = less<Key>, class A = allocator<T> > class std::map;
Concept
The sample program defines a map whose keys are strings and whose values are integers. Several entries are made into the map, by use of [] and =. A default value (0 in this case) is made if an entry is created without assigning any value.
The entries are iterated over in the usual way. Each iterator access returns a pair<key,value> pointer. Output of the program is:
Harry,25 Mary,23 Nancy,28 Perry,0
Special Notes:
multimap supports duplicate keys.
Supported
Supported
Supported