名前空間
変種
操作

std::unordered_multimap<Key,T,Hash,KeyEqual,Allocator>::max_bucket_count

From cppreference.com
 
 
 
 
size_type max_bucket_count() const;
(C++11以降)

システムまたはライブラリの実装上の制限により、コンテナが保持できるバケットの最大数を返します。

目次

[編集] パラメータ

(なし)

[編集] 戻り値

バケットの最大数。

[編集] 計算量

定数。

[編集]

#include <iostream>
#include <unordered_map>
 
int main()
{
    struct Ha { std::size_t operator()(long x) const { return std::hash<long>{}(x); }; };
 
    auto c1 = std::unordered_multimap<char, long>{};
    auto c2 = std::unordered_multimap<long, long>{};
    auto c3 = std::unordered_multimap<long, long, std::hash<int>>{};
    auto c4 = std::unordered_multimap<long, 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) [編集]
English 日本語 中文(简体) 中文(繁體)