Compartilhar via


unordered_multiset::operator=

Copies a hash table.

unordered_multiset& operator=(
   const unordered_multiset& _Right
);
unordered_multiset& operator=(
   unordered_multiset&& _Right
);

Parameters

Parameter

Description

_Right

The unordered_multiset Class being copied into the unordered_multiset.

Remarks

After erasing any existing elements in an unordered_multiset, operator= either copies or moves the contents of _Right into the unordered_multiset.

Example

// unordered_multiset_operator_as.cpp
// compile with: /EHsc
#include <unordered_set>
#include <iostream>

int main( )
   {
   using namespace std;
   unordered_multiset<int> v1, v2, v3;
   unordered_multiset<int>::iterator iter;

   v1.insert(10);

   cout << "v1 = " ;
   for (iter = v1.begin(); iter != v1.end(); iter++)
      cout << *iter << " ";
   cout << endl;

   v2 = v1;
   cout << "v2 = ";
   for (iter = v2.begin(); iter != v2.end(); iter++)
      cout << *iter << " ";
   cout << endl;

// move v1 into v2
   v2.clear();
   v2 = move(v1);
   cout << "v2 = ";
   for (iter = v2.begin(); iter != v2.end(); iter++)
      cout << *iter << " ";
   cout << endl;
   }

Output

v1 = 10 
v2 = 10 
v2 = 10 

Requirements

Header: <unordered_set>

Namespace: std

See Also

Reference

<unordered_set>

unordered_multiset Class