|
Boost-Commit : |
From: daniel_james_at_[hidden]
Date: 2007-12-12 19:26:05
Author: danieljames
Date: 2007-12-12 19:26:05 EST (Wed, 12 Dec 2007)
New Revision: 41994
URL: http://svn.boost.org/trac/boost/changeset/41994
Log:
Hervé Brönnimann's improved explanation of the formula for avoiding
invalidating iterators.
Text files modified:
sandbox/unordered/libs/unordered/doc/buckets.qbk | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
Modified: sandbox/unordered/libs/unordered/doc/buckets.qbk
==============================================================================
--- sandbox/unordered/libs/unordered/doc/buckets.qbk (original)
+++ sandbox/unordered/libs/unordered/doc/buckets.qbk 2007-12-12 19:26:05 EST (Wed, 12 Dec 2007)
@@ -97,9 +97,10 @@
x.rehash((x.size() + n) / x.max_load_factor() + 1);
[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
-`+ 1` is required because the container is allowed to resize when the load
-factor is equal to the maximum load factor.]
+elements, which is why the new size is divided by the maximum load factor. The
++ 1 guarantees there is no invalidation; without it, reallocation could occur
+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
[[Method] [Description]]
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk