Standard C++ Library Class Reference
Returns true if x is lexicographically less than y. Otherwise, it returns false.
template<class Key, class T, class Compare, class Allocator>
void swap (multimap<Key, T, Compare, Allocator>& a,
multimap<Key, T, Compare, Allocator>& b);
Efficiently swaps the contents of a and b.
Example
//
// multimap.cpp
//
#include <string>
#include <map>
#include <iostream.h>
typedef multimap<int, string, less<int> > months_type;
// Print out a pair
template <class First, class Second>
ostream& operator<<(ostream& out,
const pair<First,Second>& p)
{
cout << p.second << " has " << p.first << " days";
return out;
}
// Print out a multimap
ostream& operator<<(ostream& out, months_type l)
{
copy(l.begin(),l.end(), ostream_iterator
<months_type::value_type>(cout,"\n"));
return out;
}
int main(void)
{
// create a multimap of months and the number of
// days in the month
months_type months;
typedef months_type::value_type value_type;
// Put the months in the multimap
months.insert(value_type(31, string("January")));
months.insert(value_type(28, string("Febuary")));
months.insert(value_type(31, string("March")));
months.insert(value_type(30, string("April")));
months.insert(value_type(31, string("May")));
months.insert(value_type(30, string("June")));
months.insert(value_type(31, string("July")));
months.insert(value_type(31, string("August")));
months.insert(value_type(30, string("September")));