1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
// multimap::find
#include <iostream>
#include <map>
int main ()
{
std::multimap<char,int> mymm;
mymm.insert (pair<char,int>('x',10));
mymm.insert (pair<char,int>('y',20));
mymm.insert (pair<char,int>('z',30));
mymm.insert (pair<char,int>('z',40));
std::multimap<char,int>::iterator it = mymm.find('x');
mymm.erase (it);
mymm.erase (mymm.find('z'));
// print content:
std::cout << "elements in mymm:" << '\n';
std::cout << "y => " << mymm.find('y')->second << '\n';
std::cout << "z => " << mymm.find('z')->second << '\n';
return 0;
}
|