std::unorde...bucket_count(3)
π NAME π
std::unordered_multimap::max_bucket_count β std::unordered_multimap::max_bucket_count (the name is literally the same twice, and honestly? iconic π
)
okay so bestie, youβre on the std::unorde...bucket_count(3) page from the C++ Standard Libary β yes thatβs the manual name, and weβre about to make max bucket count make sense β¨
β¨ Synopsis β¨
size_type max_bucket_count() const; (since C++11)
Since C++11, this member function is right there giving you the maximum number of buckets the container can hold because of system or library implementation limitations. Itβs not βinfinite buckets era,β itβs βsystem/library says this is the capβ era π.
π§Έ Parameters π§Έ
(none) β literally no parameters. She takes nothing, she returns the max, she leaves π
πΈ Return value πΈ
Maximum number of buckets. Thatβs the whole return value, no extra lore π
β‘ Complexity β‘
Constant. Thatβs it β constant complexity, no extra lore π₯
π 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
π¦ See also π¦
bucket_countβ returns the number of buckets (public member function) π
source/version: cppreference.com β¨ date: 2024.06.10 π«Ά manual tag: std::unorde...bucket_count(3) π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms