Use pre-review copy of unordered for trunk.

[SVN r42183]
This commit is contained in:
Daniel James
2007-12-19 22:42:12 +00:00
parent 3f2f75faf6
commit 56f91ea407
26 changed files with 508 additions and 1164 deletions

View File

@ -1,17 +1,15 @@
project boost/doc ;
import boostbook : boostbook ;
# Copyright 2005 Daniel James.
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
boostbook doc : src/boost.xml
:
using quickbook ;
## Build the various generated docs (Doxygen and QuickBook)...
xml unordered : unordered.qbk ;
boostbook standalone : unordered :
<xsl:param>boost.root=../../../..
<xsl:param>boost.libraries=../../../libraries.htm
<xsl:param>html.stylesheet=../../../../doc/html/boostbook.css
<xsl:param>chunk.first.sections=1
<xsl:param>chunk.section.depth=2
<xsl:param>generate.section.toc.level=2
<xsl:param>toc.section.depth=1
<xsl:param>toc.max.depth=1 ;
<dependency>../libs/unordered/doc//unordered
<implicit-dependency>../libs/unordered/doc//unordered
#<dependency>../libs/functional/hash/doc//hash
#<implicit-dependency>../libs/functional/hash/doc//hash
<xsl:param>boost.libraries=../../libs/libraries.htm
;

View File

@ -7,8 +7,8 @@
The containers are made up of a number of 'buckets', each of which can contain
any number of elements. For example, the following diagram shows an [classref
boost::unordered_set unordered_set] with 7 buckets containing 5 elements, `A`,
`B`, `C`, `D` and `E` (this is just for illustration, containers will typically
have more buckets).
`B`, `C`, `D` and `E` (this is just for illustration, in practise containers
will have more buckets).
[$../../libs/unordered/doc/diagrams/buckets.png]
@ -97,10 +97,9 @@ elements into container `x`, you could first call:
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 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.]
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.]
[table Methods for Controlling Bucket Size
[[Method] [Description]]

View File

@ -8,16 +8,19 @@
[[Associative Containers] [Unordered Associative Containers]]
[
[Parameterized by an ordering relation `Compare`]
[Parameterized by a function object `Hash` and an equivalence relation
[Parametrised by an ordering relation `Compare`]
[Parametrised by a function object `Hash` and an equivalence relation
`Pred`]
]
[
[Keys can be compared using `key_compare` which is accessed by member function `key_comp()`,
values can be compared using `value_compare` which is accessed by member function `value_comp()`.]
[Keys can be hashed using `hasher` which is accessed by member function `hash_function()`,
and checked for equality using `key_equal` which is accessed by member function `key_eq()`.
There is no function object for compared or hashing values.]
[`Compare` exposed by member typedef `key_compare`, accessed by member function `key_comp()`]
[`Hash` exposed by member typedef `hasher`, accessed by member function `hash_function()`.
`Pred` by member typedef `key_equal` and member function `key_eq()`.]
]
[
[Member typedef `value_compare` supplies an ordering comparison for member elements, accessed by member function `value_comp()`.]
[No equivalent. No idea why.]
]
[
[Constructors have optional extra parameters for the comparison object.]
@ -102,15 +105,15 @@
]
[
[Insert a single element with a hint]
[Amortized constant if t elements inserted right after hint,
[Amortised constant if t elements inserted right after hint,
logarithmic otherwise]
[Average case constant, worst case linear (ie. the same as
a normal insert).]
]
[
[Inserting a range of /N/ elements]
[ /N/ log(`size()`+/N/) ]
[Average case O(/N/), worst case O(/N/ * `size()`)]
[/N/ log(`size()`+/N/)]
[Average case O(/N/), worst case O(/N/ * 'size()')]
]
[
[Erase by key, `k`]
@ -119,7 +122,7 @@
]
[
[Erase a single element by iterator]
[Amortized constant]
[Amortised constant]
[Average case: O(1), Worst case: O(`size()`)]
]
[
@ -135,7 +138,7 @@
[
[Find]
[logarithmic]
[Average case: O(1), Worst case: O(`size()`)]
[Average case: O(/N/), Worst case: O(`size()`)]
]
[/ TODO: Average case is probably wrong. ]
[

View File

@ -16,7 +16,7 @@ is declared as:
class ``[classref boost::unordered_set unordered_set]``;
The hash function comes first as you might want to change the hash function
but not the equality predicate, while if you were to change the behavior
but not the equality predicate, while if you were to change the behaviour
of the equality predicate you would have to change the hash function to match
it. So, if you wanted to use the
[@http://www.isthe.com/chongo/tech/comp/fnv/ FNV-1 hash] you could write:
@ -34,21 +34,59 @@ case-insensitive dictionary:
[case_insensitive_functions]
[case_insensitive_dictionary]
This is a simplified version of the example at:
A more generic version is available at:
[@../../libs/unordered/examples/case_insensitive.hpp /libs/unordered/examples/case_insensitive.hpp]
which supports other locales and string types.
[h2 Custom Types]
Similarly, a custom hash function can be used for custom types:
[import src_code/point1.cpp]
[point_example1]
struct point {
int x;
int y;
};
Although, customizing Boost.Hash is probably a better solution:
bool operator==(point const& p1, point const& p2)
{
return p1.x == p2.x && p1.y == p2.y;
}
[import src_code/point2.cpp]
[point_example2]
struct point_hash
: std::unary_function<point, std::size_t>
{
std::size_t operator()(point const& p) const
{
std::size_t seed = 0;
boost::hash_combine(seed, p.x);
boost::hash_combine(seed, p.y);
return seed;
}
}
boost::unordered_multiset<point, std::equal_to<point>, point_hash>
points;
Although, customising Boost.Hash is probably a better solution:
struct point {
int x;
int y;
};
bool operator==(point const& p1, point const& p2)
{
return p1.x == p2.x && p1.y == p2.y;
}
std::size_t hash_value(point const& x) {
std::size_t seed = 0;
boost::hash_combine(seed, p.x);
boost::hash_combine(seed, p.y);
return seed;
}
// Now the default functions work.
boost::unordered_multiset<point> points;
See the Boost.Hash documentation for more detail on how to do this. Remember
that it relies on extensions to the draft standard - so it won't work on other

View File

@ -45,14 +45,14 @@ details). If accepted the containers should also be added to __boost-tr1__.
namespace boost {
template <
class Key,
class Hash = ``[classref boost::hash]``<Key>,
class Hash = boost::hash<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<Key> >
class ``[classref boost::unordered_set unordered_set]``;
template<
class Key,
class Hash = ``[classref boost::hash]``<Key>,
class Hash = boost::hash<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<Key> >
class ``[classref boost::unordered_multiset unordered_multiset]``;
@ -63,15 +63,15 @@ details). If accepted the containers should also be added to __boost-tr1__.
namespace boost {
template <
class Key, class Mapped,
class Hash = ``[classref boost::hash]``<Key>,
class Key, class T,
class Hash = boost::hash<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<Key> >
class ``[classref boost::unordered_map unordered_map]``;
template<
class Key, class Mapped,
class Hash = ``[classref boost::hash]``<Key>,
class Key, class T,
class Hash = boost::hash<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<Key> >
class ``[classref boost::unordered_multimap unordered_multimap]``;

View File

@ -7,7 +7,7 @@
Thomas Wang's article on integer hash functions]]
[def __n2345__
[@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2345.pdf
N2345, 'Placement Insert for Containers']]
N2345, 'Placement Instert for Containers']]
[def __n2369__
[@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2369.pdf
the August 2008 version of the working draft standard]]
@ -28,12 +28,12 @@ By specifying an interface for accessing the buckets of the container the
standard pretty much requires that the hash table uses chained addressing.
It would be conceivable to write a hash table that uses another method. For
example, it could use open addressing, and use the lookup chain to act as a
example, an it could use open addressing, and use the lookup chain to act as a
bucket but there are a some serious problems with this:
* The draft standard requires that pointers to elements aren't invalidated, so
the elements can't be stored in one array, but will need a layer of
indirection instead - losing the efficiency and most of the memory gain,
indirection instead - loosing the efficiency and most of the memory gain,
the main advantages of open addressing.
* Local iterators would be very inefficient and may not be able to
@ -98,96 +98,35 @@ So, this implementation uses a prime number for the hash table size.
[h2 Active Issues and Proposals]
[h3 Removing unused allocator functions]
[h3 [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2257.html
Removing unused allocator functions]]
In
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2257.html
N2257, removing unused allocator functions],
Matt Austern suggests removing the `construct`, `destroy` and `address` member
functions - all of which Boost.Unordered calls. Changing this will simplify the
implementation, as well as make supporting `emplace` easier, but means that the
containers won't support allocators which require these methods to be called.
Detlef Vollmann opposed this change in
[@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2339.htm N2339].
This proposal suggests removing the `construct`, `destroy` and `address`
member functions - all of which Boost.Unordered calls. It's near trivial
to replace the calls with the appropriate code - and will simplify the
implementation, as well as make supporting `emplace` easier.
[@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2339.htm
N2339] opposed this change.
[h3 Swapping containers with unequal allocators]
[h3 [@http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#431
431. Swapping containers with unequal allocators]]
It isn't clear how to swap containers when their allocators aren't equal.
This is
[@http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#431
Issue 431: Swapping containers with unequal allocators].
I followed Howard Hinnant's advice and implemented option 3.
Howard Hinnant wrote about this in
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1599.html N1599]
and suggested swapping both the allocators and the containers' contents.
But the committee have now decided that `swap` should do a fast swap if the
There is currently a further issue - if the allocator's swap does throw there's
no guarantee what state the allocators will be in. The only solution seems to
be to double buffer the allocators. But I'm assuming that it won't throw for now.
Update: The committee have now decided that `swap` should do a fast swap if the
allocator is Swappable and a slow swap using copy construction otherwise. To
make this distinction requires concepts.
make this distinction requires concepts. For now I'm sticking with the current
implementation.
In
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2387.pdf
N2387, Omnibus Allocator Fix-up Proposals],
Pablo Halpern suggests that there are actually two distinct allocator models,
"Moves with Value" and "Scoped" which behave differently:
[h3 [@http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#518
518. Are insert and erase stable for unordered_multiset and unordered_multimap?]]
[:
When allocators are allowed to have state, it is necessary to have a model for
determining from where an object obtains its allocator. Weve identified two such
models: the “Moves with Value” allocator model and the “Scoped” allocator model.
In the “Moves with Value” allocator model, the copy constructor of an allocator-aware
class will copy both the value and the allocator from its argument. This is the model
specified in the C++03 standard. With this model, inserting an object into a container
usually causes the new container item to copy the allocator from the object that was
inserted. This model can be useful in special circumstances, e.g., if the items within a
container use an allocator that is specially tuned to the items type.
In the “Scoped” allocator model, the allocator used to construct an object is determined
by the context of that object, much like a storage class. With this model, inserting an
object into a container causes the new container item to use the same allocator as the
container. To avoid allocators being used in the wrong context, the allocator is never
copied during copy or move construction. Thus, it is possible using this model to use
allocators based on short-lived resources without fear that an object will transfer its
allocator to a copy that might outlive the (shared) allocator resource. This model is
reasonably safe and generally useful on a large scale. There was strong support in the
2005 Tremblant meeting for pursuing an allocator model that propagates allocators
from container to contained objects.
]
With these models the choice becomes clearer:
[:
I introduced the “Moves with Value” allocator model and the
“Scoped” allocator model. In the former case, the allocator is copied when the container
is copy-constructed. In the latter case it is not. Swapping the allocators is the right thing
to do if the containers conform to the “Moves with Value” allocator model and
absolutely the wrong thing to do if the containers conform to the “Scoped” allocator
model. With the two allocator models well-defined, the desired behavior becomes clear.
]
The proposal is that allocators are swapped if the allocator follows the
"Moves with Value" model and the allocator is swappable. Otherwise a slow swap
is used. Since containers currently only support the "Moves with Value" model
this is consistent with the committee's current recommendation (although it
suggests using a trait to detect if the allocator is swappable rather than a
concept).
Since there is currently neither have a swappable trait or concept for
allocators this implementation always performs a slow swap.
[h3 Are insert and erase stable for unordered_multiset and unordered_multimap?]
It is not specified if `unordered_multiset` and `unordered_multimap` preserve the order
of elements with equivalent keys (i.e. if they're stable under `insert` and `erase`).
This is [@http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#518 issue 581].
The current proposal is that insert, erase and rehash are stable - so they are here.
[h3 const_local_iterator cbegin, cend missing from TR1]
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2482.html#691
Issue 691] is that `cbegin` and `cend` are missing for local iterators.
The current resolution is that they'll be added, so I've added them.
[h2 Future Developments]
[h3 Support for `emplace`]

View File

@ -128,7 +128,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>A const_local_iterator object can be used to iterate through a single bucket.</para>
</description>
</typedef>
<constructor specifiers="explicit">
<constructor>
<parameter name="n">
<paramtype>size_type</paramtype>
<default><emphasis>implementation-defined</emphasis></default>
@ -149,7 +149,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<code><methodname>size</methodname>() == 0</code>
</postconditions>
<description>
<para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.</para>
<para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocatorand a maximum load factor of 1.0.</para>
</description>
</constructor>
<constructor>
@ -263,7 +263,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</description>
<returns>
<para>The bool component of the return type is true if an insert took place.</para>
<para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.</para>
<para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the elment with equivalent value.</para>
</returns>
<throws>
<para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para>
@ -285,7 +285,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>hint is a suggestion to where the element should be inserted.</para>
</description>
<returns>
<para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.</para>
<para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the elment with equivalent value.</para>
</returns>
<throws>
<para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para>
@ -329,8 +329,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>The iterator following <code>position</code> before the erasure.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
<para>They don't get called by the current implementation Boost.Unordered but other implementations may call them.</para>
</throws>
</method>
<method name="erase">
@ -345,7 +345,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>The number of elements erased.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
</throws>
</method>
<method name="erase">
@ -356,15 +356,15 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>const_iterator</paramtype>
</parameter>
<type>iterator</type>
<description>
<descritpion>
<para>Erases the elements in the range from <code>first</code> to <code>last</code>.</para>
</description>
</descritpion>
<returns>
<para>The iterator following the erased elements - i.e. <code>last</code>.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
<para>They don't get called by the current implementation Boost.Unordered but other implementations may call them.</para>
</throws>
</method>
<method name="clear">
@ -385,12 +385,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</parameter>
<type>void</type>
<throws>
<para>If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para>
<para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para>
</throws>
<notes>
<para>For a discussion of the behaviour when allocators aren't equal see
<link linkend="unordered.rationale.swapping_containers_with_unequal_allocators">the implementation details</link>.</para>
</notes>
</method>
</method-group>
<method-group name="observers">
@ -443,7 +439,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<parameter name="k">
<paramtype>key_type const&amp;</paramtype>
</parameter>
<type>std::pair&lt;const_iterator, const_iterator&gt;</type>
<type>std::pair&lt;iterator, iterator&gt;</type>
</signature>
<returns>
<para>A range containing all elements with key equivalent to <code>k</code>.
@ -530,30 +526,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
</returns>
</overloaded-method>
<method name="cbegin" cv="const">
<parameter name="n">
<paramtype>size_type</paramtype>
</parameter>
<type>const_local_iterator</type>
<requires>
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
</requires>
<returns>
<para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para>
</returns>
</method>
<method name="cend">
<parameter name="n">
<paramtype>size_type</paramtype>
</parameter>
<type>const_local_iterator</type>
<requires>
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
</requires>
<returns>
<para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
</returns>
</method>
</method-group>
<method-group name="hash policy">
<method name="load_factor" cv="const">
@ -591,71 +563,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</throws>
</method>
</method-group>
<free-function-group name="Equality Comparisons">
<function name="operator==">
<template>
<template-type-parameter name="Value">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_set&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_set&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
<function name="operator!=">
<template>
<template-type-parameter name="Value">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_set&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_set&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
<function name="hash_value">
<template>
<template-type-parameter name="Value">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_set&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>std::size_t</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
</free-function-group>
<free-function-group name="swap">
<function name="swap">
<template>
@ -669,22 +576,18 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_set&lt;Value, Hash, Pred, Alloc&gt;&amp;</paramtype>
<paramtype>unordered_set&lt;Key, T, Hash, Pred, Alloc&gt;&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_set&lt;Value, Hash, Pred, Alloc&gt;&amp;</paramtype>
<paramtype>unordered_set&lt;Key, T, Hash, Pred, Alloc&gt;&amp;</paramtype>
</parameter>
<type>void</type>
<effects>
<para><code>x.swap(y)</code></para>
</effects>
<throws>
<para>If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>Hash</code> or <code>Pred</code>.</para>
<para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>Hash</code> or <code>Pred</code>.</para>
</throws>
<notes>
<para>For a discussion of the behaviour when allocators aren't equal see
<link linkend="unordered.rationale.swapping_containers_with_unequal_allocators">the implementation details</link>.</para>
</notes>
</function>
</free-function-group>
</class>
@ -805,7 +708,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>A const_local_iterator object can be used to iterate through a single bucket.</para>
</description>
</typedef>
<constructor specifiers="explicit">
<constructor>
<parameter name="n">
<paramtype>size_type</paramtype>
<default><emphasis>implementation-defined</emphasis></default>
@ -826,7 +729,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<code><methodname>size</methodname>() == 0</code>
</postconditions>
<description>
<para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.</para>
<para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocatorand a maximum load factor of 1.0.</para>
</description>
</constructor>
<constructor>
@ -1005,8 +908,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>The iterator following <code>position</code> before the erasure.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
<para>They don't get called by the current implementation Boost.Unordered but other implementations may call them.</para>
</throws>
</method>
<method name="erase">
@ -1021,7 +924,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>The number of elements erased.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
</throws>
</method>
<method name="erase">
@ -1032,15 +935,15 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>const_iterator</paramtype>
</parameter>
<type>iterator</type>
<description>
<descritpion>
<para>Erases the elements in the range from <code>first</code> to <code>last</code>.</para>
</description>
</descritpion>
<returns>
<para>The iterator following the erased elements - i.e. <code>last</code>.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
<para>They don't get called by the current implementation Boost.Unordered but other implementations may call them.</para>
</throws>
</method>
<method name="clear">
@ -1061,12 +964,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</parameter>
<type>void</type>
<throws>
<para>If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para>
<para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para>
</throws>
<notes>
<para>For a discussion of the behaviour when allocators aren't equal see
<link linkend="unordered.rationale.swapping_containers_with_unequal_allocators">the implementation details</link>.</para>
</notes>
</method>
</method-group>
<method-group name="observers">
@ -1119,7 +1018,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<parameter name="k">
<paramtype>key_type const&amp;</paramtype>
</parameter>
<type>std::pair&lt;const_iterator, const_iterator&gt;</type>
<type>std::pair&lt;iterator, iterator&gt;</type>
</signature>
<returns>
<para>A range containing all elements with key equivalent to <code>k</code>.
@ -1206,30 +1105,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
</returns>
</overloaded-method>
<method name="cbegin" cv="const">
<parameter name="n">
<paramtype>size_type</paramtype>
</parameter>
<type>const_local_iterator</type>
<requires>
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
</requires>
<returns>
<para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para>
</returns>
</method>
<method name="cend">
<parameter name="n">
<paramtype>size_type</paramtype>
</parameter>
<type>const_local_iterator</type>
<requires>
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
</requires>
<returns>
<para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
</returns>
</method>
</method-group>
<method-group name="hash policy">
<method name="load_factor" cv="const">
@ -1267,71 +1142,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</throws>
</method>
</method-group>
<free-function-group name="Equality Comparisons">
<function name="operator==">
<template>
<template-type-parameter name="Value">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_multiset&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_multiset&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
<function name="operator!=">
<template>
<template-type-parameter name="Value">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_multiset&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_multiset&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
<function name="hash_value">
<template>
<template-type-parameter name="Value">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_multiset&lt;Value, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>std::size_t</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
</free-function-group>
<free-function-group name="swap">
<function name="swap">
<template>
@ -1345,22 +1155,18 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_multiset&lt;Value, Hash, Pred, Alloc&gt;&amp;</paramtype>
<paramtype>unordered_multiset&lt;Key, T, Hash, Pred, Alloc&gt;&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_multiset&lt;Value, Hash, Pred, Alloc&gt;&amp;</paramtype>
<paramtype>unordered_multiset&lt;Key, T, Hash, Pred, Alloc&gt;&amp;</paramtype>
</parameter>
<type>void</type>
<effects>
<para><code>x.swap(y)</code></para>
</effects>
<throws>
<para>If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>Hash</code> or <code>Pred</code>.</para>
<para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>Hash</code> or <code>Pred</code>.</para>
</throws>
<notes>
<para>For a discussion of the behaviour when allocators aren't equal see
<link linkend="unordered.rationale.swapping_containers_with_unequal_allocators">the implementation details</link>.</para>
</notes>
</function>
</free-function-group>
</class>
@ -1381,7 +1187,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<template>
<template-type-parameter name="Key">
</template-type-parameter>
<template-type-parameter name="Mapped">
<template-type-parameter name="T">
</template-type-parameter>
<template-type-parameter name="Hash">
<default><type>boost::hash&lt;Value&gt;</type></default>
@ -1390,7 +1196,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<default><type>std::equal_to&lt;Value&gt;</type></default>
</template-type-parameter>
<template-type-parameter name="Alloc">
<default><type>std::allocator&lt;std::pair&lt;const Key, Mapped&gt; &gt;</type></default>
<default><type>std::allocator&lt;std::pair&lt;const Key, T&gt; &gt;</type></default>
</template-type-parameter>
</template>
<purpose>An unordered associative container that associates unique keys with another value.
@ -1406,8 +1212,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<entry><emphasis>Key</emphasis></entry>
<entry>Key must be Assignable and CopyConstructible.</entry></row>
<row>
<entry><emphasis>Mapped</emphasis></entry>
<entry>Mapped must be CopyConstructible</entry></row>
<entry><emphasis>T</emphasis></entry>
<entry>T must be CopyConstructible</entry></row>
<row>
<entry><emphasis>Hash</emphasis></entry>
<entry>A unary function object type that acts a hash function for a <code>Key</code>. It takes a single argument of type <code>Key</code> and returns a value of type std::size_t.</entry></row>
@ -1429,7 +1235,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<type>std::pair&lt;Key const, Value&gt;</type>
</typedef>
<typedef name="mapped_type">
<type>Mapped</type>
<type>T</type>
</typedef>
<typedef name="hasher">
<type>Hash</type>
@ -1497,7 +1303,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>A const_local_iterator object can be used to iterate through a single bucket.</para>
</description>
</typedef>
<constructor specifiers="explicit">
<constructor>
<parameter name="n">
<paramtype>size_type</paramtype>
<default><emphasis>implementation-defined</emphasis></default>
@ -1518,7 +1324,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<code><methodname>size</methodname>() == 0</code>
</postconditions>
<description>
<para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.</para>
<para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocatorand a maximum load factor of 1.0.</para>
</description>
</constructor>
<constructor>
@ -1632,7 +1438,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</description>
<returns>
<para>The bool component of the return type is true if an insert took place.</para>
<para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.</para>
<para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the elment with equivalent key.</para>
</returns>
<throws>
<para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para>
@ -1654,7 +1460,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>hint is a suggestion to where the element should be inserted.</para>
</description>
<returns>
<para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.</para>
<para>If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the elment with equivalent key.</para>
</returns>
<throws>
<para>If an exception is thrown by an operation other than a call to <code>hasher</code> the function has no effect.</para>
@ -1698,8 +1504,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>The iterator following <code>position</code> before the erasure.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
<para>They don't get called by the current implementation Boost.Unordered but other implementations may call them.</para>
</throws>
</method>
<method name="erase">
@ -1714,7 +1520,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>The number of elements erased.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
</throws>
</method>
<method name="erase">
@ -1725,15 +1531,15 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>const_iterator</paramtype>
</parameter>
<type>iterator</type>
<description>
<descritpion>
<para>Erases the elements in the range from <code>first</code> to <code>last</code>.</para>
</description>
</descritpion>
<returns>
<para>The iterator following the erased elements - i.e. <code>last</code>.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
<para>They don't get called by the current implementation Boost.Unordered but other implementations may call them.</para>
</throws>
</method>
<method name="clear">
@ -1754,12 +1560,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</parameter>
<type>void</type>
<throws>
<para>If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para>
<para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para>
</throws>
<notes>
<para>For a discussion of the behaviour when allocators aren't equal see
<link linkend="unordered.rationale.swapping_containers_with_unequal_allocators">the implementation details</link>.</para>
</notes>
</method>
</method-group>
<method-group name="observers">
@ -1812,7 +1614,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<parameter name="k">
<paramtype>key_type const&amp;</paramtype>
</parameter>
<type>std::pair&lt;const_iterator, const_iterator&gt;</type>
<type>std::pair&lt;iterator, iterator&gt;</type>
</signature>
<returns>
<para>A range containing all elements with key equivalent to <code>k</code>.
@ -1840,9 +1642,9 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</notes>
</method>
<overloaded-method name="at">
<signature><type>Mapped&amp;</type>
<signature><type>T&amp;</type>
<parameter name="k"><paramtype>key_type const&amp;</paramtype></parameter></signature>
<signature cv="const"><type>Mapped const&amp;</type>
<signature cv="const"><type>T const&amp;</type>
<parameter name="k"><paramtype>key_type const&amp;</paramtype></parameter></signature>
<returns>
<para>A reference to <code>x.second</code> where <code>x</code> is the (unique) element whose key is equivalent to <code>k</code>.</para>
@ -1933,30 +1735,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
</returns>
</overloaded-method>
<method name="cbegin" cv="const">
<parameter name="n">
<paramtype>size_type</paramtype>
</parameter>
<type>const_local_iterator</type>
<requires>
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
</requires>
<returns>
<para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para>
</returns>
</method>
<method name="cend">
<parameter name="n">
<paramtype>size_type</paramtype>
</parameter>
<type>const_local_iterator</type>
<requires>
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
</requires>
<returns>
<para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
</returns>
</method>
</method-group>
<method-group name="hash policy">
<method name="load_factor" cv="const">
@ -1994,83 +1772,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</throws>
</method>
</method-group>
<free-function-group name="Equality Comparisons">
<function name="operator==">
<template>
<template-type-parameter name="Key">
</template-type-parameter>
<template-type-parameter name="Mapped">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_map&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_map&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
<function name="operator!=">
<template>
<template-type-parameter name="Key">
</template-type-parameter>
<template-type-parameter name="Mapped">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_map&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_map&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
<function name="hash_value">
<template>
<template-type-parameter name="Key">
</template-type-parameter>
<template-type-parameter name="Mapped">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_map&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>std::size_t</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
</free-function-group>
<free-function-group name="swap">
<function name="swap">
<template>
<template-type-parameter name="Key">
</template-type-parameter>
<template-type-parameter name="Mapped">
<template-type-parameter name="T">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
@ -2080,22 +1787,18 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_map&lt;Key, Mapped, Hash, Pred, Alloc&gt;&amp;</paramtype>
<paramtype>unordered_map&lt;Key, T, Hash, Pred, Alloc&gt;&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_map&lt;Key, Mapped, Hash, Pred, Alloc&gt;&amp;</paramtype>
<paramtype>unordered_map&lt;Key, T, Hash, Pred, Alloc&gt;&amp;</paramtype>
</parameter>
<type>void</type>
<effects>
<para><code>x.swap(y)</code></para>
</effects>
<throws>
<para>If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>Hash</code> or <code>Pred</code>.</para>
<para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>Hash</code> or <code>Pred</code>.</para>
</throws>
<notes>
<para>For a discussion of the behaviour when allocators aren't equal see
<link linkend="unordered.rationale.swapping_containers_with_unequal_allocators">the implementation details</link>.</para>
</notes>
</function>
</free-function-group>
</class>
@ -2108,7 +1811,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<template>
<template-type-parameter name="Key">
</template-type-parameter>
<template-type-parameter name="Mapped">
<template-type-parameter name="T">
</template-type-parameter>
<template-type-parameter name="Hash">
<default><type>boost::hash&lt;Value&gt;</type></default>
@ -2117,7 +1820,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<default><type>std::equal_to&lt;Value&gt;</type></default>
</template-type-parameter>
<template-type-parameter name="Alloc">
<default><type>std::allocator&lt;std::pair&lt;const Key, Mapped&gt; &gt;</type></default>
<default><type>std::allocator&lt;std::pair&lt;const Key, T&gt; &gt;</type></default>
</template-type-parameter>
</template>
<purpose>An unordered associative container that associates keys with another value. The same key can be stored multiple times.
@ -2133,8 +1836,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<entry><emphasis>Key</emphasis></entry>
<entry>Key must be Assignable and CopyConstructible.</entry></row>
<row>
<entry><emphasis>Mapped</emphasis></entry>
<entry>Mapped must be CopyConstructible</entry></row>
<entry><emphasis>T</emphasis></entry>
<entry>T must be CopyConstructible</entry></row>
<row>
<entry><emphasis>Hash</emphasis></entry>
<entry>A unary function object type that acts a hash function for a <code>Key</code>. It takes a single argument of type <code>Key</code> and returns a value of type std::size_t.</entry></row>
@ -2156,7 +1859,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<type>std::pair&lt;Key const, Value&gt;</type>
</typedef>
<typedef name="mapped_type">
<type>Mapped</type>
<type>T</type>
</typedef>
<typedef name="hasher">
<type>Hash</type>
@ -2224,7 +1927,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>A const_local_iterator object can be used to iterate through a single bucket.</para>
</description>
</typedef>
<constructor specifiers="explicit">
<constructor>
<parameter name="n">
<paramtype>size_type</paramtype>
<default><emphasis>implementation-defined</emphasis></default>
@ -2245,7 +1948,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<code><methodname>size</methodname>() == 0</code>
</postconditions>
<description>
<para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.</para>
<para>Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocatorand a maximum load factor of 1.0.</para>
</description>
</constructor>
<constructor>
@ -2424,8 +2127,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>The iterator following <code>position</code> before the erasure.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
<para>They don't get called by the current implementation Boost.Unordered but other implementations may call them.</para>
</throws>
</method>
<method name="erase">
@ -2440,7 +2143,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>The number of elements erased.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
</throws>
</method>
<method name="erase">
@ -2451,15 +2154,15 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<paramtype>const_iterator</paramtype>
</parameter>
<type>iterator</type>
<description>
<descritpion>
<para>Erases the elements in the range from <code>first</code> to <code>last</code>.</para>
</description>
</descritpion>
<returns>
<para>The iterator following the erased elements - i.e. <code>last</code>.</para>
</returns>
<throws>
<para>Only throws an exception if it is thrown by <code>hasher</code> or <code>key_equal</code>.</para>
<para>In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.</para>
<para>Only throws an exception, if it is thrown by a call to <code>hasher</code> or <code>key_equal</code>.</para>
<para>They don't get called by the current implementation Boost.Unordered but other implementations may call them.</para>
</throws>
</method>
<method name="clear">
@ -2480,12 +2183,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</parameter>
<type>void</type>
<throws>
<para>If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para>
<para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>key_equal</code> or <code>hasher</code>.</para>
</throws>
<notes>
<para>For a discussion of the behaviour when allocators aren't equal see
<link linkend="unordered.rationale.swapping_containers_with_unequal_allocators">the implementation details</link>.</para>
</notes>
</method>
</method-group>
<method-group name="observers">
@ -2538,7 +2237,7 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<parameter name="k">
<paramtype>key_type const&amp;</paramtype>
</parameter>
<type>std::pair&lt;const_iterator, const_iterator&gt;</type>
<type>std::pair&lt;iterator, iterator&gt;</type>
</signature>
<returns>
<para>A range containing all elements with key equivalent to <code>k</code>.
@ -2625,30 +2324,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<para>A local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
</returns>
</overloaded-method>
<method name="cbegin" cv="const">
<parameter name="n">
<paramtype>size_type</paramtype>
</parameter>
<type>const_local_iterator</type>
<requires>
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
</requires>
<returns>
<para>A constant local iterator pointing the first element in the bucket with index <code>n</code>.</para>
</returns>
</method>
<method name="cend">
<parameter name="n">
<paramtype>size_type</paramtype>
</parameter>
<type>const_local_iterator</type>
<requires>
<para><code>n</code> shall be in the range <code>[0, bucket_count())</code>.</para>
</requires>
<returns>
<para>A constant local iterator pointing the 'one past the end' element in the bucket with index <code>n</code>.</para>
</returns>
</method>
</method-group>
<method-group name="hash policy">
<method name="load_factor" cv="const">
@ -2686,83 +2361,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</throws>
</method>
</method-group>
<free-function-group name="Equality Comparisons">
<function name="operator==">
<template>
<template-type-parameter name="Key">
</template-type-parameter>
<template-type-parameter name="Mapped">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_multimap&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_multimap&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
<function name="operator!=">
<template>
<template-type-parameter name="Key">
</template-type-parameter>
<template-type-parameter name="Mapped">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_multimap&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_multimap&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>bool</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
<function name="hash_value">
<template>
<template-type-parameter name="Key">
</template-type-parameter>
<template-type-parameter name="Mapped">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
<template-type-parameter name="Pred">
</template-type-parameter>
<template-type-parameter name="Alloc">
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_multimap&lt;Key, Mapped, Hash, Pred, Alloc&gt; const&amp;</paramtype>
</parameter>
<type>std::size_t</type>
<notes>
<para>This is a boost extension.</para>
</notes>
</function>
</free-function-group>
<free-function-group name="swap">
<function name="swap">
<template>
<template-type-parameter name="Key">
</template-type-parameter>
<template-type-parameter name="Mapped">
<template-type-parameter name="T">
</template-type-parameter>
<template-type-parameter name="Hash">
</template-type-parameter>
@ -2772,22 +2376,18 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
</template-type-parameter>
</template>
<parameter name="x">
<paramtype>unordered_multimap&lt;Key, Mapped, Hash, Pred, Alloc&gt;&amp;</paramtype>
<paramtype>unordered_multimap&lt;Key, T, Hash, Pred, Alloc&gt;&amp;</paramtype>
</parameter>
<parameter name="y">
<paramtype>unordered_multimap&lt;Key, Mapped, Hash, Pred, Alloc&gt;&amp;</paramtype>
<paramtype>unordered_multimap&lt;Key, T, Hash, Pred, Alloc&gt;&amp;</paramtype>
</parameter>
<type>void</type>
<effects>
<para><code>x.swap(y)</code></para>
</effects>
<throws>
<para>If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>Hash</code> or <code>Pred</code>.</para>
<para>Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of <code>Hash</code> or <code>Pred</code>.</para>
</throws>
<notes>
<para>For a discussion of the behaviour when allocators aren't equal see
<link linkend="unordered.rationale.swapping_containers_with_unequal_allocators">the implementation details</link>.</para>
</notes>
</function>
</free-function-group>
</class>

View File

@ -5,5 +5,5 @@
<title>The Boost C++ Unordered Containers Library Documentation</title>
<xi:include href="unordered.xml"/>
<xi:include href="hash.xml"/>
<!-- <xi:include href="hash.xml"/> -->
</boostbook>

View File

@ -14,7 +14,7 @@
bool operator()(std::string const& x,
std::string const& y) const
{
return boost::algorithm::iequals(x, y, std::locale());
return boost::algorithm::iequals(x, y);
}
};
@ -24,12 +24,11 @@
std::size_t operator()(std::string const& x) const
{
std::size_t seed = 0;
std::locale locale;
for(std::string::const_iterator it = x.begin();
it != x.end(); ++it)
{
boost::hash_combine(seed, std::toupper(*it, locale));
boost::hash_combine(seed, std::toupper(*it));
}
return seed;

View File

@ -27,7 +27,7 @@ namespace hash_examples
template <typename String1, typename String2>
bool operator()(String1 const& x1, String2 const& x2) const
{
return boost::algorithm::iequals(x1, x2, locale_);
return boost::algorithm::iequals(x1, x2);
}
private:
std::locale locale_;

View File

@ -42,9 +42,6 @@ namespace boost {
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <class T>
inline void reset(T& x) { x = T(); }
template <class Ptr>
inline Ptr null_ptr() { return Ptr(); }
#else
template <class T>
inline void reset_impl(T& x, ...) { x = T(); }
@ -52,9 +49,6 @@ namespace boost {
inline void reset_impl(T*& x, int) { x = 0; }
template <class T>
inline void reset(T& x) { reset_impl(x); }
template <class Ptr>
inline Ptr null_ptr() { Ptr x; reset(x); return x; }
#endif
// Work around for Microsoft's ETI bug.

View File

@ -82,21 +82,17 @@ namespace boost {
// no throw
inline std::size_t next_prime(std::size_t n) {
std::size_t const* const prime_list_end = prime_list +
sizeof(prime_list) / sizeof(*prime_list);
std::size_t const* bound =
std::lower_bound(prime_list,prime_list_end, n);
if(bound == prime_list_end)
std::lower_bound(prime_list,prime_list + 28, n);
if(bound == prime_list + 28)
bound--;
return *bound;
}
// no throw
inline std::size_t prev_prime(std::size_t n) {
std::size_t const* const prime_list_end = prime_list +
sizeof(prime_list) / sizeof(*prime_list);
std::size_t const* bound =
std::upper_bound(prime_list,prime_list_end, n);
std::upper_bound(prime_list,prime_list + 28, n);
if(bound != prime_list)
bound--;
return *bound;

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,8 @@
#include <functional>
#include <memory>
#include <boost/functional/hash.hpp>
#include <boost/unordered/detail/hash_table.hpp>
#include <boost/functional/hash.hpp>
namespace boost
{
@ -294,6 +294,7 @@ namespace boost
return const_local_iterator(base.end(n));
}
#if defined(BOOST_UNORDERED_LOCAL_CBEGIN)
const_local_iterator cbegin(size_type n) const
{
return const_local_iterator(base.begin(n));
@ -303,6 +304,7 @@ namespace boost
{
return const_local_iterator(base.end(n));
}
#endif
// hash policy
@ -325,21 +327,6 @@ namespace boost
{
base.rehash(n);
}
friend bool operator==(unordered_map const& m1, unordered_map const& m2)
{
return m1.base.equals(m2.base);
}
friend bool operator!=(unordered_map const& m1, unordered_map const& m2)
{
return !m1.base.equals(m2.base);
}
friend std::size_t hash_value(unordered_map const& m)
{
return m.base.hash_value();
}
}; // class template unordered_map
template <class K, class T, class H, class P, class A>
@ -606,6 +593,7 @@ namespace boost
return const_local_iterator(base.end(n));
}
#if defined(BOOST_UNORDERED_LOCAL_CBEGIN)
const_local_iterator cbegin(size_type n) const
{
return const_local_iterator(base.begin(n));
@ -615,6 +603,7 @@ namespace boost
{
return const_local_iterator(base.end(n));
}
#endif
// hash policy
@ -637,21 +626,6 @@ namespace boost
{
base.rehash(n);
}
friend bool operator==(unordered_multimap const& m1, unordered_multimap const& m2)
{
return m1.base.equals(m2.base);
}
friend bool operator!=(unordered_multimap const& m1, unordered_multimap const& m2)
{
return !m1.base.equals(m2.base);
}
friend std::size_t hash_value(unordered_multimap const& m)
{
return m.base.hash_value();
}
}; // class template unordered_multimap
template <class K, class T, class H, class P, class A>

View File

@ -16,8 +16,8 @@
#include <functional>
#include <memory>
#include <boost/functional/hash.hpp>
#include <boost/unordered/detail/hash_table.hpp>
#include <boost/functional/hash.hpp>
namespace boost
{
@ -264,6 +264,7 @@ namespace boost
return const_local_iterator(base.end(n));
}
#if defined(BOOST_UNORDERED_LOCAL_CBEGIN)
const_local_iterator cbegin(size_type n) const
{
return const_local_iterator(base.begin(n));
@ -273,6 +274,7 @@ namespace boost
{
return const_local_iterator(base.end(n));
}
#endif
// hash policy
@ -295,21 +297,6 @@ namespace boost
{
base.rehash(n);
}
friend bool operator==(unordered_set const& m1, unordered_set const& m2)
{
return m1.base.equals(m2.base);
}
friend bool operator!=(unordered_set const& m1, unordered_set const& m2)
{
return !m1.base.equals(m2.base);
}
friend std::size_t hash_value(unordered_set const& m)
{
return m.base.hash_value();
}
}; // class template unordered_set
template <class T, class H, class P, class A>
@ -561,6 +548,7 @@ namespace boost
return const_local_iterator(base.end(n));
}
#if defined(BOOST_UNORDERED_LOCAL_CBEGIN)
const_local_iterator cbegin(size_type n) const
{
return const_local_iterator(base.begin(n));
@ -570,6 +558,7 @@ namespace boost
{
return const_local_iterator(base.end(n));
}
#endif
// hash policy
@ -592,21 +581,6 @@ namespace boost
{
base.rehash(n);
}
friend bool operator==(unordered_multiset const& m1, unordered_multiset const& m2)
{
return m1.base.equals(m2.base);
}
friend bool operator!=(unordered_multiset const& m1, unordered_multiset const& m2)
{
return !m1.base.equals(m2.base);
}
friend std::size_t hash_value(unordered_multiset const& m)
{
return m.base.hash_value();
}
}; // class template unordered_multiset
template <class T, class H, class P, class A>

View File

@ -16,7 +16,6 @@ mkdir $UNORDERED_DST/doc/html/images/
cp $BOOST_ROOT/doc/html/*.css $UNORDERED_DST/doc/html/
cp $BOOST_ROOT/doc/html/images/*.png $UNORDERED_DST/doc/html/images/
rm -r $UNORDERED_DST/libs/functional
rm -r $UNORDERED_DST/bin.v2
rm $UNORDERED_DST/release.sh

View File

@ -111,7 +111,6 @@ void container_test(X& r, T&)
(&a1)->~X();
X const a_const;
test::check_return_type<iterator>::equals(a.begin());
test::check_return_type<const_iterator>::equals(a_const.begin());
test::check_return_type<const_iterator>::equals(a.cbegin());
@ -120,18 +119,12 @@ void container_test(X& r, T&)
test::check_return_type<const_iterator>::equals(a_const.end());
test::check_return_type<const_iterator>::equals(a.cend());
test::check_return_type<const_iterator>::equals(a_const.cend());
}
template <class X, class T>
void equality_test(X& r, T&)
{
X const a = r, b = r;
// No tests for ==, != since they're not required for unordered containers.
test::check_return_type<bool>::equals(a == b);
test::check_return_type<bool>::equals(a != b);
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
test::check_return_type<std::size_t>::equals(boost::hash_value(a));
#else
test::check_return_type<std::size_t>::equals(hash_value(a));
#endif
a.swap(b);
test::check_return_type<X>::equals_ref(r = a);
test::check_return_type<size_type>::equals(a.size());
test::check_return_type<size_type>::equals(a.max_size());
test::check_return_type<bool>::convertible(a.empty());
}

View File

@ -13,7 +13,7 @@
#include "../objects/minimal.hpp"
#include "./compile_tests.hpp"
void container_tests()
int main()
{
typedef std::pair<test::minimal::assignable const,
test::minimal::copy_constructible> value_type;
@ -40,36 +40,6 @@ void container_tests()
test::minimal::allocator<value_type> > multimap;
container_test(multimap, value);
}
void equality_tests() {
typedef std::pair<test::minimal::assignable const,
test::minimal::copy_constructible_equality_comparable> value_type;
value_type value(
test::minimal::assignable::create(),
test::minimal::copy_constructible_equality_comparable::create());
boost::unordered_map<
test::minimal::assignable,
test::minimal::copy_constructible_equality_comparable,
test::minimal::hash<test::minimal::assignable>,
test::minimal::equal_to<test::minimal::assignable>,
test::minimal::allocator<value_type> > map;
equality_test(map, value);
boost::unordered_multimap<
test::minimal::assignable,
test::minimal::copy_constructible_equality_comparable,
test::minimal::hash<test::minimal::assignable>,
test::minimal::equal_to<test::minimal::assignable>,
test::minimal::allocator<value_type> > multimap;
equality_test(multimap, value);
}
int main() {
container_tests();
equality_tests();
return boost::report_errors();
}

View File

@ -25,7 +25,6 @@ int main()
test::minimal::allocator<test::minimal::assignable> > set;
container_test(set, assignable);
equality_test(set, assignable);
std::cout<<"Test unordered_multiset.\n";
boost::unordered_multiset<
@ -35,7 +34,6 @@ int main()
test::minimal::allocator<test::minimal::assignable> > multiset;
container_test(multiset, assignable);
equality_test(multiset, assignable);
return boost::report_errors();
}

View File

@ -21,5 +21,5 @@ test-suite unordered-tests
[ run erase_tests.cpp framework ]
[ run rehash_tests.cpp framework ]
[ run swap_tests.cpp framework : : :
<define>BOOST_UNORDERED_SWAP_METHOD=2 ]
<define>BOOST_UNORDERED_SWAP_METHOD=3 ]
;

View File

@ -73,7 +73,11 @@ struct insert_test2 : public insert_test_base<T>
template <class T>
struct insert_test3 : public insert_test_base<T>
{
void run(T& x) const {
typedef typename insert_test_base<T>::strong_type strong_type;
void run(T& x, strong_type& strong) const {
// I don't think there's any need for this here.
//strong.store(x);
x.insert(this->values.begin(), this->values.end());
}
@ -161,52 +165,7 @@ struct insert_test_rehash2 : public insert_test_rehash1<T>
}
};
template <class T>
struct insert_test_rehash3 : public insert_test_base<T>
{
typename T::size_type mutable rehash_bucket_count, original_bucket_count;
insert_test_rehash3() : insert_test_base<T>(1000) {}
T init() const {
typedef typename T::size_type size_type;
T x;
x.max_load_factor(0.25);
original_bucket_count = x.bucket_count();
rehash_bucket_count = static_cast<size_type>(
std::ceil(original_bucket_count * x.max_load_factor())) - 1;
size_type initial_elements = rehash_bucket_count - 5;
BOOST_REQUIRE(initial_elements < this->values.size());
x.insert(this->values.begin(),
boost::next(this->values.begin(), initial_elements));
BOOST_REQUIRE(original_bucket_count == x.bucket_count());
return x;
}
void run(T& x) const {
typename T::size_type bucket_count = x.bucket_count();
x.insert(boost::next(this->values.begin(), x.size()),
boost::next(this->values.begin(), x.size() + 20));
// This isn't actually a failure, but it means the test isn't doing its
// job.
BOOST_REQUIRE(x.bucket_count() != bucket_count);
}
void check(T const& x) const {
if(x.size() < rehash_bucket_count) {
//BOOST_CHECK(x.bucket_count() == original_bucket_count);
}
test::check_equivalent_keys(x);
}
};
RUN_EXCEPTION_TESTS(
(insert_test1)(insert_test2)(insert_test3)(insert_test4)
(insert_test_rehash1)(insert_test_rehash2)(insert_test_rehash3),
(insert_test_rehash1)(insert_test_rehash2),
CONTAINER_SEQ)

View File

@ -7,6 +7,7 @@
#define BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER
#include <boost/iterator_adaptors.hpp>
#include <boost/shared_ptr.hpp>
namespace test
{

View File

@ -18,7 +18,6 @@ namespace test
namespace minimal
{
class copy_constructible;
class copy_constructible_equality_comparable;
class default_copy_constructible;
class assignable;
template <class T> class hash;
@ -38,29 +37,6 @@ namespace minimal
copy_constructible() {}
};
class copy_constructible_equality_comparable
{
public:
static copy_constructible_equality_comparable create() { return copy_constructible_equality_comparable(); }
copy_constructible_equality_comparable(copy_constructible_equality_comparable const&) {}
~copy_constructible_equality_comparable() {}
private:
copy_constructible_equality_comparable& operator=(copy_constructible_equality_comparable const&);
copy_constructible_equality_comparable() {}
};
bool operator==(copy_constructible_equality_comparable, copy_constructible_equality_comparable) {
return true;
}
bool operator!=(copy_constructible_equality_comparable, copy_constructible_equality_comparable) {
return false;
}
std::size_t hash_value(copy_constructible_equality_comparable) {
return 1;
}
class default_copy_constructible
{
public:
@ -241,8 +217,7 @@ namespace minimal
size_type max_size() const { return 1000; }
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) || \
BOOST_WORKAROUND(MSVC, <= 1300)
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
public: allocator& operator=(allocator const&) { return *this;}
#else
private: allocator& operator=(allocator const&);

View File

@ -27,5 +27,5 @@ test-suite unordered-tests
[ run bucket_tests.cpp ]
[ run load_factor_tests.cpp ]
[ run rehash_tests.cpp ]
[ run swap_tests.cpp : : : <define>BOOST_UNORDERED_SWAP_METHOD=2 ]
[ run swap_tests.cpp : : : <define>BOOST_UNORDERED_SWAP_METHOD=3 ]
;

View File

@ -41,10 +41,8 @@ void bucket_tests(X* = 0)
for(size_type i = 0; i < x.bucket_count(); ++i) {
BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x.begin(i), x.end(i)));
BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x.cbegin(i), x.cend(i)));
X const& x_ref = x;
BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x_ref.begin(i), x_ref.end(i)));
BOOST_TEST(x.bucket_size(i) == (size_type) std::distance(x_ref.cbegin(i), x_ref.cend(i)));
}
}

View File

@ -190,11 +190,6 @@ void unordered_test(X&, Key& k, T& t, Hash& hf, Pred& eq)
test::check_return_type<local_iterator>::equals(a.end(0));
test::check_return_type<const_local_iterator>::equals(b.end(0));
test::check_return_type<const_local_iterator>::equals(a.cbegin(0));
test::check_return_type<const_local_iterator>::equals(b.cbegin(0));
test::check_return_type<const_local_iterator>::equals(a.cend(0));
test::check_return_type<const_local_iterator>::equals(b.cend(0));
test::check_return_type<float>::equals(b.load_factor());
test::check_return_type<float>::equals(b.max_load_factor());
a.max_load_factor((float) 2.0);