std::unorde...iset::rehash(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ NAME ✨

Bestie, welcome to std::unorde...iset::rehash(3) from the C++ Standard Libary manual 🫢 β€” this page is all about std::unordered_multiset::rehash, aka std::unordered_multiset::rehash, the member function that changes your bucket count situation πŸ’…

🌸 Synopsis 🌸

void rehash( size_type count );  (since C++11)

Okay so this one changes the number of buckets to a value n that is not less than count and satisfies

n >= size() / max_load_factor()

then rehashes the container, i.e. puts the elements into appropriate buckets considering that total number of buckets has changed ✨

πŸŽ€ Parameters πŸŽ€

  • count β€” lower bound for the new number of buckets

πŸ’… Return value πŸ’…

  • (none) β€” literally nothing comes back, no return value era πŸ™ˆ

πŸ”₯ Complexity πŸ”₯

Average case linear in the size of the container, worst case quadratic. Ngl, worst case said quadratic 😭

πŸ¦‹ Notes πŸ¦‹

rehash(0) may be used to force an unconditional rehash, such as after suspension of automatic rehashing by temporarily increasing max_load_factor().

⭐ See also ⭐

  • reserve β€” reserves space for at least the specified number of elements and regenerates the hash table (public member function)

Okay bestie, that’s the whole page πŸ’– source/version: http://cppreference.com; version/date: 2024.06.10; page: std::unorde...iset::rehash(3). Now go rehash responsibly βœ¨πŸ‘‘

πŸ“¦ where this page comes from