mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 20:04:29 +02:00
Hervé Brönnimann's improved explanation of the formula for avoiding
invalidating iterators. [SVN r41994]
This commit is contained in:
@@ -97,9 +97,10 @@ elements into container `x`, you could first call:
|
|||||||
x.rehash((x.size() + n) / x.max_load_factor() + 1);
|
x.rehash((x.size() + n) / x.max_load_factor() + 1);
|
||||||
|
|
||||||
[blurb Note: `rehash`'s argument is the number of buckets, not the number of
|
[blurb Note: `rehash`'s argument is the number of buckets, not the number of
|
||||||
elements, which is why the new size is divided by the maximum load factor. The
|
elements, which is why the new size is divided by the maximum load factor. The
|
||||||
`+ 1` is required because the container is allowed to resize when the load
|
+ 1 guarantees there is no invalidation; without it, reallocation could occur
|
||||||
factor is equal to the maximum load factor.]
|
if the number of bucket exactly divides the target size, since the container is
|
||||||
|
allowed to rehash when the load factor is equal to the maximum load factor.]
|
||||||
|
|
||||||
[table Methods for Controlling Bucket Size
|
[table Methods for Controlling Bucket Size
|
||||||
[[Method] [Description]]
|
[[Method] [Description]]
|
||||||
|
Reference in New Issue
Block a user