std::unorde...ap::reserve(3)
πΈ NAME πΈ
okay so bestie, we're in the C++ Standard Libary manual (yes, that's the spelling on the page, iconic) and the header is std::unorde...ap::reserve(3). This function is std::unordered_multimap::reserve, and it's giving "make room for my elements" energy. π
π¦ Synopsis π¦
void reserve( size_type count ); (since C++11)
bestie, what it does: sets the number of buckets to the number needed to accommodate at least count elements without exceeding maximum load factor and rehashes the container, i.e. puts the elements into appropriate buckets considering that total number of buckets has changed. Effectively calls rehash(std::ceil(count / max_load_factor())).
π Parameters π
countβ new capacity of the container. That's the glow-up size, okay? β¨
β¨ Return value β¨
(none) β literally nothing, no cap. It's a void function, so don't go looking for a return value, bestie. π«Ά
π₯ Complexity π₯
Average case linear in the size of the container, worst case quadratic. So usually a smooth little linear slay, but worst case? quadratic, and we respect the warning. π
π See also π
rehashβ public member function that reserves at least the specified number of buckets and regenerates the hash table. The way it eats and leaves no crumbs. π
big kiss and a sparkle from the cppreference.com girlies β source http://cppreference.com, version/date 2024.06.10, and that's the whole footer vibe, periodt. πβ¨
π¦ 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