1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
// assignment operator with multimaps
#include <iostream>
#include <map>
using namespace std;
int main ()
{
multimap<char,int> first;
multimap<char,int> second;
first.insert(pair<char,int>('x',32));
first.insert(pair<char,int>('y',64));
first.insert(pair<char,int>('y',96));
first.insert(pair<char,int>('z',128));
second=first; // second now contains 4 ints
first=multimap<char,int>(); // and first is now empty
cout << "Size of first: " << int (first.size()) << endl;
cout << "Size of second: " << int (second.size()) << endl;
return 0;
}
|