std::unorde...set::reserve(3)
π NAME π
std::unordered_set::reserve β std::unordered_set::reserve
okay so this is the <pink>C++ Standard Libary</pink> manual page for std::unordered_set::reserve(3), and it's literally giving bucket-management main character energy. π
β¨
β¨ Synopsis β¨
void reserve( size_type count ); (since C++11)
It sets the number of buckets to the number needed to accommodate at least count elements without exceeding the maximum load factor, then rehashes the container β aka 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. π«
π Parameters π
countβ new capacity of the container. that's the whole parameter, bestie π
π Return value π
(none) β no return value, she just does the thing and dips π
π₯ Complexity π₯
- Average case: linear in the size of the container π₯
- Worst case: quadratic π
π¦ See also π¦
rehashβ reserves at least the specified number of buckets and regenerates the hash table (public member function) π¦
that's the whole page, bestie π source: http://cppreference.com Β· version/date: 2024.06.10 Β· std::unordered_set::reserve(3) outtieee π«Άβ¨
π¦ 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