1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
// multimap::clear
#include <iostream>
#include <map>
int main ()
{
std::multimap<char,int> mymultimap;
std::multimap<char,int>::iterator it;
mymultimap.insert(std::pair<char,int>('b',80));
mymultimap.insert(std::pair<char,int>('b',120));
mymultimap.insert(std::pair<char,int>('q',360));
std::cout << "mymultimap contains:\n";
for (it=mymultimap.begin(); it!=mymultimap.end(); ++it)
std::cout << (*it).first << " => " << (*it).second << '\n';
mymultimap.clear();
mymultimap.insert(std::pair<char,int>('a',11));
mymultimap.insert(std::pair<char,int>('x',22));
std::cout << "mymultimap contains:\n";
for (it=mymultimap.begin(); it != mymultimap.end(); ++it)
std::cout << (*it).first << " => " << (*it).second << '\n';
return 0;
}
| |