unordered_map_bucket_count

unordered_map_bucket_count (std::unordered_map::bucket_count — 버킷 개수)

std::unordered_map의 버킷 개수를 반환하는 멤버 함수예요.

출처: cppreference

본문

시그니처는 다음과 같아요.

size_type bucket_count() const noexcept;

컨테이너의 버킷 개수를 반환해요.

반환값

버킷의 개수.

복잡도

상수(constant)예요.

예제

#include <iostream>
#include <unordered_map>
int main()
{
    std::unordered_map<int, char> m{{1, 'a'}, {2, 'b'}};
    std::cout << m.bucket_count() << '\n';   // 구현/상태 의존
}

함께 보기

  • bucket: 특정 키가 매핑된 버킷 인덱스를 반환해요
  • max_bucket_count: 최대 버킷 개수를 반환해요

더 알아보기 (Learn more)

cppreference