unordered_set::merge
unordered_set::merge (병합)
merge()는 다른 정렬되지 않은 집합의 요소를 이 컨테이너로 이동해 병합해요. 동등한 키가 이미 있으면 그 요소는 건너뛰어요. C++17에서 추가됐어요.
출처: cppreference
본문
merge는 source의 각 요소를 추출해 이 컨테이너의 해시 함수와 키 동등성 술어를 사용해 삽입해요. 요소가 복사·이동되지 않고 연결만 바뀌어요.
template< class H2, class P2 >
void merge( std::unordered_set<Key, H2, P2, Allocator>& source );
복잡도 (Complexity)
평균적으로 source.size()에 선형, 최악의 경우 이차 시간이에요.