std::unorde...map::reserve(3)
okay bestie, buckle up: this is std::unorde...map::reserve(3) from the C++ Standard Libary manual π
β¨ (yes, βLibary,β she said what she said π).
π NAME π
std::unordered_map::reserve β std::unordered_map::reserve (itβs giving βsame name, same energy,β and honestly? iconic π).
β¨ Synopsis β¨
void reserve( size_type count ); (since C++11)
okay so what does it actually do? It sets the number of buckets to the number needed to accommodate at least count elements without exceeding maximum load factor, and it rehashes the container β i.e. it puts the elements into appropriate buckets considering that the total number of buckets has changed. Effectively calls rehash(std::ceil(count / max_load_factor())). no cap, thatβs the whole vibe π¦
πΈ Parameters πΈ
countβ the new capacity of the container, bestie. Thatβs the number weβre reserving room for.
π Return value π
(none) β literally nothing comes back. void behavior, no notes, periodt π
.
π¦ Complexity π¦
Average case is linear in the size of the container, but worst case? quadratic π. So like, donβt get caught sleeping on the worst case, okay?
π See also π
rehashβ reserves at least the specified number of buckets and regenerates the hash table (public member function). bestie behavior, fr fr π«Ά.
xoxo, source: http://cppreference.com, dated 2024.06.10 β from the std::unorde...map::reserve(3) page in the C++ Standard Libary manual ππ§
π¦ 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