std::unordered_map<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_map<char, long>{}; auto c2 = std::unordered_map<long, long>{}; auto c3 = std::unordered_map<long, long, std::hash<int>>{}; auto c4 = std::unordered_map<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) |