C++ Standard Library multimap Sample

Description

multimap is an associative container structure, that stores (key,value) pairs. Unlike map, multimap supports duplicate keys, so that you can have multiple entries with the same key but with different values.

Declaration

	template <class Key, class T, class Cmp = less<Key>,
	    class A = allocator<T> >
	       class std::multimap;

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 make_pair(). Note that the operator [] used with map cannot be used with multimap, because a given key can have multiple values associated with it.

The entries are iterated over in the usual way. Each iterator access returns a pair<key,value> pointer. Output of the program is:

	Harry,32
	Mary,59
	Mary,23
	Nancy,37
	Roger,18

Supported
Supported
Supported