C++ 함수 std::unordered_multimap::operator=()는 이전 내용을 대체하여 unordered_multimap에 새 내용을 할당하고 필요한 경우 크기를 수정합니다.
다음은 std::unordered_multimap::operator=() 함수 formstd::unordered_map() 헤더에 대한 선언입니다.
C++11(구문)
unordered_multimap& operator=(const unordered_multimap& umm);
매개변수
umm - Another unordered_multimap object of same type.
반환 값
Returns this pointer.
예시 코드
#include <iostream>
#include <unordered_map>
using namespace std;
int main(void) {
unordered_multimap umm1 = {
{'a', 1},
{'b', 2},
{'c', 3},
{'d', 4},
{'e', 5},
};
unordered_multimap umm2;
umm2 = umm1;
cout << "Unordered multimap contains following elements" << endl;
for (auto it = umm2.begin(); it != umm2.end(); ++it)
cout << it->first << " = " << it->second << endl;
return 0;
} 출력
Unordered multimap contains following elements e = 5 a = 1 b = 2 c = 3 d = 4