| multimap::operator= | 
public member function | 
multimap<Key,T,Compare,Allocator>&
     operator= ( const multimap<Key,T,Compare,Allocator>& x ); | 
 | 
Copy container content
Assigns a copy of the elements in x as the new content for the container.
The elements contained in the object before the call are dropped, and replaced by copies of those in multimap x, if any.
After a call to this member function, both the multimap object and x will have the same size and compare equal to each other.
Parameters
- x
 
- A multimap object with the same class template parameters (Key, T, Compare and Allocator).
 
Return value
*thisExample
// 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;
}
 | 
Output:
Size of first: 0 Size of second: 4
   | 
Complexity
Linear on 
sizes (destruction, copy construction).
See also