다음을 통해 공유


multiset::operator=

Replaces the elements of this multiset using elements from another multiset.

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

매개 변수

Parameter

설명

_Right

The multiset from which elements are copied or moved.

설명

operator= copies or moves the elements in _Right into this multiset, depending on the reference type (lvalue or rvalue) used. Elements that are in this multiset before operator= executes are discarded.

예제

// 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;
   }

Output

v1 = 10 
v2 = 10 
v2 = 10 

요구 사항

Header: <multiset>

네임스페이스: std

참고 항목

참조

multiset 클래스

표준 템플릿 라이브러리