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

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

okay so bestie, we're in the C++ Standard Libary manual β€” page std::unorde...imap::rehash(3) β€” and the main character is std::unordered_multimap::rehash. The header is doing its shortened little thing, but the full name is right below. πŸ’…

πŸŽ€ NAME πŸŽ€

std::unordered_multimap::rehash - std::unordered_multimap::rehash. That's it, that's the name, no cap. πŸ’–

✨ Synopsis ✨

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

Okay so rehash 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. slay. ✨

🌸 Parameters 🌸

  • count β€” lower bound for the new number of buckets. periodt. πŸ’…

πŸŽ€ Return value πŸŽ€

(none) β€” literally nothing coming back, bestie. πŸ’€

πŸ¦‹ Complexity πŸ¦‹

Average case linear in the size of the container, worst case quadratic. That worst case is giving β€œhandle with care” energy, ngl. 😭

πŸ’œ Notes πŸ’œ

rehash(0) may be used to force an unconditional rehash, such as after suspension of automatic rehashing by temporarily increasing max_load_factor(). Lowkey iconic little escape hatch, iykyk. ✨

πŸ‘€ 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 page 🫢 β€” source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::unorde...imap::rehash(3). C++ Standard Libary manual out. πŸ’–

πŸ“¦ where this page comes from