std::unordered_multimap<Key,T,Hash,KeyEqual,Allocator>::max_bucket_count
From cppreference.com
 
 
 < cpp | container | unordered multimap 
 
 
 C++ 
 Feature test macros (C++20)
 Concepts library (C++20)
 Metaprogramming library (C++11)
 Ranges library (C++20)
 Filesystem library (C++17)
 Concurrency support library (C++11)
 Execution control library (C++26)
Containers library 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
(C++17)
(C++11)
(C++26)
(C++26)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++23)
(C++23)
(C++23)
(C++23)
(C++20)
(C++23)
 Tables
std::unordered_multimap (C++23)
(C++17)
(C++17)
(C++20)
unordered_multimap::max_bucket_count
(until C++20)
 Deduction guides (C++17)
size_type max_bucket_count() const;
 
 (since C++11) 
Returns the maximum number of buckets the container is able to hold due to system or library implementation limitations.
[edit] Parameters
(none)
[edit] Return value
Maximum number of buckets.
[edit] Complexity
Constant.
[edit] Example
Run this code
#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' ; }
Possible output:
Max bucket count of c1: 0xfffffffffffffff c2: 0xfffffffffffffff c3: 0xfffffffffffffff c4: 0xaaaaaaaaaaaaaaa