diff options
Diffstat (limited to 'doc/html/unordered/buckets.html')
-rw-r--r-- | doc/html/unordered/buckets.html | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/doc/html/unordered/buckets.html b/doc/html/unordered/buckets.html index a8b83c4af6..06ea2214b7 100644 --- a/doc/html/unordered/buckets.html +++ b/doc/html/unordered/buckets.html @@ -45,7 +45,7 @@ key is the whole element, but is referred to as the key so that the same terminology can be used for sets and maps). This returns a value of type <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code>. <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code> has a much greater range of values - then the number of buckets, so that container applies another transformation + then the number of buckets, so the container applies another transformation to that value to choose a bucket to place the element in. </p> <p> @@ -70,7 +70,7 @@ <p> </p> <div class="table"> -<a name="idp604253664"></a><p class="title"><b>Table 44.1. Methods for Accessing Buckets</b></p> +<a name="id-1.3.45.4.8.1"></a><p class="title"><b>Table 44.1. Methods for Accessing Buckets</b></p> <div class="table-contents"><table class="table" summary="Methods for Accessing Buckets"> <colgroup> <col> @@ -100,22 +100,20 @@ <tr> <td><code class="computeroutput"><span class="identifier">size_type</span> <span class="identifier">bucket</span><span class="special">(</span><span class="identifier">key_type</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">k</span><span class="special">)</span> <span class="keyword">const</span></code></td> <td>Returns - the index of the bucket which would contain k</td> + the index of the bucket which would contain <code class="computeroutput"><span class="identifier">k</span></code>.</td> </tr> <tr> -<td><code class="computeroutput"><span class="identifier">local_iterator</span> - <span class="identifier">begin</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">);</span></code></td> -<td rowspan="6">Return begin and end iterators for bucket - <code class="computeroutput"><span class="identifier">n</span></code>.</td> +<td><code class="computeroutput"><span class="identifier">local_iterator</span> <span class="identifier">begin</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">);</span></code></td> +<td rowspan="6">Return + begin and end iterators for bucket <code class="computeroutput"><span class="identifier">n</span></code>.</td> </tr> -<tr><td><code class="computeroutput"><span class="identifier">local_iterator</span> - <span class="identifier">end</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">);</span></code></td></tr> +<tr><td><code class="computeroutput"><span class="identifier">local_iterator</span> <span class="identifier">end</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">);</span></code></td></tr> +<tr><td><code class="computeroutput"><span class="identifier">const_local_iterator</span> <span class="identifier">begin</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr> <tr><td><code class="computeroutput"><span class="identifier">const_local_iterator</span> - <span class="identifier">begin</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr> -<tr><td><code class="computeroutput"><span class="identifier">const_local_iterator</span> <span class="identifier">end</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr> + <span class="identifier">end</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr> +<tr><td><code class="computeroutput"><span class="identifier">const_local_iterator</span> <span class="identifier">cbegin</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr> <tr><td><code class="computeroutput"><span class="identifier">const_local_iterator</span> - <span class="identifier">cbegin</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr> -<tr><td><code class="computeroutput"><span class="identifier">const_local_iterator</span> <span class="identifier">cend</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr> + <span class="identifier">cend</span><span class="special">(</span><span class="identifier">size_type</span> <span class="identifier">n</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></code></td></tr> </tbody> </table></div> </div> @@ -135,7 +133,7 @@ </p> <p> The standard leaves a lot of freedom to the implementer to decide how the number - of buckets are chosen, but it does make some requirements based on the container's + of buckets is chosen, but it does make some requirements based on the container's 'load factor', the average number of elements per bucket. Containers also have a 'maximum load factor' which they should try to keep the load factor below. </p> @@ -257,8 +255,8 @@ </td> <td> <p> - Changes the number of buckets so that there at least n buckets, and - so that the load factor is less than the maximum load factor. + Changes the number of buckets so that there at least <code class="computeroutput"><span class="identifier">n</span></code> buckets, and so that the load + factor is less than the maximum load factor. </p> </td> </tr> @@ -275,8 +273,9 @@ affect the bucket count, although <code class="computeroutput"><span class="identifier">insert</span></code> is only allowed to invalidate iterators when the insertion causes the load factor to be greater than or equal to the maximum load factor. For most implementations - this means that insert will only change the number of buckets when this happens. - While iterators can be invalidated by calls to <code class="computeroutput"><span class="identifier">insert</span></code> + this means that <code class="computeroutput"><span class="identifier">insert</span></code> will + only change the number of buckets when this happens. While iterators can be + invalidated by calls to <code class="computeroutput"><span class="identifier">insert</span></code> and <code class="computeroutput"><span class="identifier">rehash</span></code>, pointers and references to the container's elements are never invalidated. </p> @@ -290,18 +289,14 @@ elements into container <code class="computeroutput"><span class="identifier">x</span></code>, you could first call: </p> -<pre class="programlisting"><span class="identifier">x</span><span class="special">.</span><span class="identifier">rehash</span><span class="special">((</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">n</span><span class="special">)</span> <span class="special">/</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">max_load_factor</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">);</span> +<pre class="programlisting"><span class="identifier">x</span><span class="special">.</span><span class="identifier">rehash</span><span class="special">((</span><span class="identifier">x</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">n</span><span class="special">)</span> <span class="special">/</span> <span class="identifier">x</span><span class="special">.</span><span class="identifier">max_load_factor</span><span class="special">());</span> </pre> -<div class="sidebar"> +<div class="blurb"> <div class="titlepage"><div><div><p class="title"><b></b></p></div></div></div> <p> Note: <code class="computeroutput"><span class="identifier">rehash</span></code>'s argument is the minimum number of buckets, not the number of elements, which is why the - new size is divided by the maximum load factor. The <code class="computeroutput"><span class="special">+</span> - <span class="number">1</span></code> 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. + new size is divided by the maximum load factor. </p> </div> </div> |