std::unordered_multiset<Key,Hash,KeyEqual,Allocator>:: max_bucket_count
From cppreference.net
<
cpp
|
container
|
unordered multiset
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::unordered_multiset
| Member types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Deduction guides (C++17) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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
另请参阅
|
返回桶的数量
(公开成员函数) |