multiset::operator=
Zastępuje elementy tego multiset za pomocą elementów z innego multiset.
multiset& operator=(
const multiset& _Right
);
multiset& operator=(
multiset&& _Right
);
Parametry
Parametr |
Opis |
_Right |
multiset z elementy, które są kopiowane lub przenoszone. |
Uwagi
operator=kopiuje lub przenosi elementy w _Right w tym multiset, w zależności od typu odwołania (lvalue lub r-wartości) używane.Elementy, które są w tym multiset przed operator= wykonuje są odrzucane.
Przykład
// multiset_operator_as.cpp
// compile with: /EHsc
#include <multiset>
#include <iostream>
int main( )
{
using namespace std;
multiset<int> v1, v2, v3;
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;
}
Dane wyjściowe
v1 = 10
v2 = 10
v2 = 10
Wymagania
Nagłówek:<zestaw wielokrotny>
Przestrzeń nazw: std