Namespaces
Variants

std::unordered_multiset<Key,Hash,KeyEqual,Allocator>:: max_bucket_count

From cppreference.net

size_type max_bucket_count ( ) const ;
(C++11 이후)

컨테이너가 시스템 또는 라이브러리 구현 제한으로 인해 보유할 수 있는 최대 버킷 수를 반환합니다.

목차

매개변수

(없음)

반환값

최대 버킷 수.

복잡도

상수.

예제

#include <iostream>
#include <unordered_set>
int main()
{
    struct Ha { std::size_t operator()(long x) const { return std::hash<long>{}(x); }; };
    auto c1 = std::unordered_multiset<char>{};
    auto c2 = std::unordered_multiset<long>{};
    auto c3 = std::unordered_multiset<long, std::hash<int>>{};
    auto c4 = std::unordered_multiset<long, Ha>{};
    std::cout
        << "Max bucket count of\n" << std::hex << std::showbase
        << "c1: " << c1.max_bucket_count() << '\n'
        << "c2: " << c2.max_bucket_count() << '\n'
        << "c3: " << c3.max_bucket_count() << '\n'
        << "c4: " << c4.max_bucket_count() << '\n'
        ;
}

가능한 출력:

Max bucket count of
c1: 0xfffffffffffffff
c2: 0xfffffffffffffff
c3: 0xfffffffffffffff
c4: 0xaaaaaaaaaaaaaaa

참고 항목

버킷 수를 반환합니다
(public member function)