GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing cplusplus.com — std::unordered_map::reserve Reference
<unordered_map>
unordered_map
public member function
<unordered_map>
std::unordered_map::reservevoid reserve ( size_type n ); Request a capacity change
If n is greater than the current bucket_count multiplied by the max_load_factor, the container's bucket_count is increased and a rehash is forced. If n is lower than that, the function may have no effect. Parameters
Return valuenoneExample
Possible output:
By calling reserve with the size we expected for the unordered_map container we avoided the multiple rehashes that the increases in container size could have produced and optimized the size of the hash table. ComplexityIn case of rehash,Average case: linear in container size. Worst case: quadratic in container size. Iterator validityIf a rehash happens, all iterators are invalidated, but references and pointers to individual elements remain valid.If no actual rehash happens, no changes. See also
Home page | Privacy policy
© cplusplus.com, 2000-2026 - All rights reserved - v3.3.4s Spotted an error? contact us | |||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |