unordered_set

unordered_set (정렬되지 않은 집합)

std::unordered_set은 중복을 허용하지 않는 정렬되지 않은 집합 컨테이너예요. Key 타입의 고유한 객체들을 해시 테이블에 저장하며, 평균적으로 상수 시간에 탐색·삽입·삭제가 가능해요.

출처: cppreference

본문

std::unordered_set은 타입 Key의 고유한(unique) 객체를 담는 연관 컨테이너예요. 해시 함수로 버킷을 결정하기 때문에 요소 순서는 정의되지 않아요.

template<
    class Key,
    class Hash = std::hash<Key>,
    class KeyEqual = std::equal_to<Key>,
    class Allocator = std::allocator<Key>
> class unordered_set;

같은 값은 하나만 저장돼요. 탐색·삽입·제거가 평균 상수 시간으로 동작해요.

더 알아보기 (Learn more)

cppreference