2007-05-31 22:33:39 +00:00
|
|
|
[/ Copyright 2006-2007 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) ]
|
|
|
|
|
|
|
|
[def __tr1__
|
2007-11-21 11:10:45 +00:00
|
|
|
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf
|
2007-05-31 22:33:39 +00:00
|
|
|
C++ Standard Library Technical Report]]
|
|
|
|
[def __boost-tr1__
|
|
|
|
[@http://www.boost.org/doc/html/boost_tr1.html
|
|
|
|
Boost.TR1]]
|
|
|
|
[def __draft__
|
2007-11-03 16:48:06 +00:00
|
|
|
[@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2461.pdf
|
2007-05-31 22:33:39 +00:00
|
|
|
Working Draft of the C++ Standard]]
|
|
|
|
[def __hash-table__ [@http://en.wikipedia.org/wiki/Hash_table
|
|
|
|
hash table]]
|
|
|
|
[def __hash-function__ [@http://en.wikipedia.org/wiki/Hash_function
|
|
|
|
hash function]]
|
|
|
|
|
|
|
|
[section:intro Introduction]
|
|
|
|
|
|
|
|
For accessing data based on key lookup, the C++ standard library offers `std::set`,
|
|
|
|
`std::map`, `std::multiset` and `std::multimap`. These are generally
|
|
|
|
implemented using balanced binary trees so that lookup time has
|
|
|
|
logarithmic complexity. That is generally okay, but in many cases a
|
|
|
|
__hash-table__ can perform better, as accessing data has constant complexity,
|
|
|
|
on average. The worst case complexity is linear, but that occurs rarely and
|
|
|
|
with some care, can be avoided.
|
|
|
|
|
|
|
|
Also, the existing containers require a 'less than' comparison object
|
|
|
|
to order their elements. For some data types this is impossible to implement
|
Merged revisions 41808-41821,41823-41927,41934-41942,41944-41950,41952-41993,41998-42091,42094-42095,42104-42105,42107,42109,42111-42152,42154,42160-42171,42173-42180,42183-42196,42198-42402 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r41993 | danieljames | 2007-12-13 00:23:27 +0000 (Thu, 13 Dec 2007) | 3 lines
Add the hash documentation to the unordered library so that it'll be easier to
link between the libraries.
........
r42104 | danieljames | 2007-12-16 13:36:50 +0000 (Sun, 16 Dec 2007) | 1 line
Don't include any hash source in tarballs (although I'm including the documentation).
........
r42198 | danieljames | 2007-12-20 10:49:10 +0000 (Thu, 20 Dec 2007) | 1 line
Restore the extra warnings in the unit tests.
........
r42199 | danieljames | 2007-12-20 11:25:38 +0000 (Thu, 20 Dec 2007) | 1 line
Make a cast explicit in order to avoid a warning.
........
r42203 | danieljames | 2007-12-20 15:54:31 +0000 (Thu, 20 Dec 2007) | 1 line
Use 'BOOST_UNORDERED' prefix for macros.
........
r42209 | danieljames | 2007-12-20 19:41:17 +0000 (Thu, 20 Dec 2007) | 1 line
Initialise this branch (hopefully..)
........
r42210 | danieljames | 2007-12-20 19:51:21 +0000 (Thu, 20 Dec 2007) | 1 line
Merge in changes.
........
r42215 | danieljames | 2007-12-20 21:15:42 +0000 (Thu, 20 Dec 2007) | 1 line
Don't add size_type to pointers, cast to difference_type.
........
r42216 | danieljames | 2007-12-20 21:17:38 +0000 (Thu, 20 Dec 2007) | 1 line
I messed up the last commit, this fixes it.
........
r42218 | danieljames | 2007-12-20 21:22:20 +0000 (Thu, 20 Dec 2007) | 1 line
Get rid of last_in_group.
........
r42219 | danieljames | 2007-12-20 21:27:46 +0000 (Thu, 20 Dec 2007) | 1 line
Use node_count to implement group_count.
........
r42231 | danieljames | 2007-12-21 12:04:52 +0000 (Fri, 21 Dec 2007) | 1 line
Some minor changes for Visual C++.
........
r42233 | danieljames | 2007-12-21 19:41:27 +0000 (Fri, 21 Dec 2007) | 1 line
Inline some more methods.
........
r42335 | danieljames | 2007-12-29 13:14:45 +0000 (Sat, 29 Dec 2007) | 3 lines
Some of the changes to the introduction mention in the review. Hopefully this
will make it a little clearer.
........
r42336 | danieljames | 2007-12-29 13:16:55 +0000 (Sat, 29 Dec 2007) | 3 lines
Try to make the buckets explanation a little easier to read. Most of the
changes were based on Jamie Allsop (same for the last commit).
........
r42339 | danieljames | 2007-12-29 16:00:32 +0000 (Sat, 29 Dec 2007) | 1 line
Specify the namespace for 'std::out_of_range' in the reference documentation.
........
r42345 | danieljames | 2007-12-29 20:41:10 +0000 (Sat, 29 Dec 2007) | 8 lines
Rewrite much of the 'controlling the number of buckets' section.
I'm trying to make it clearer. It's a bit tricky as the standard doesn't guarantee much.
Instead of diving straight into the details I have tried to give the reader a rough
idea of what 'rehash' does and what the load factor is. This is hopefully enough to
understand the more detailled discussion of how you can control the number of buckets.
Then finally I discuss iterator invalidation.
........
r42346 | danieljames | 2007-12-29 20:52:22 +0000 (Sat, 29 Dec 2007) | 1 line
Move the table summarizing methods for controlling bucket size next to the discussion of these methods. The paragraphs about insert and invalidating iterator moves on to something else.
........
r42348 | danieljames | 2007-12-29 20:55:30 +0000 (Sat, 29 Dec 2007) | 1 line
Fix the badly marked up bullet points.
........
r42349 | danieljames | 2007-12-29 20:57:53 +0000 (Sat, 29 Dec 2007) | 2 lines
We now have cbegin and cend for local iterators.
........
[SVN r42403]
2008-01-01 20:21:04 +00:00
|
|
|
or isn't practical. In contrast, a hash table only needs an equality function
|
2007-05-31 22:33:39 +00:00
|
|
|
and a hash function for the key.
|
|
|
|
|
Merged revisions 41808-41821,41823-41927,41934-41942,41944-41950,41952-41993,41998-42091,42094-42095,42104-42105,42107,42109,42111-42152,42154,42160-42171,42173-42180,42183-42196,42198-42402 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r41993 | danieljames | 2007-12-13 00:23:27 +0000 (Thu, 13 Dec 2007) | 3 lines
Add the hash documentation to the unordered library so that it'll be easier to
link between the libraries.
........
r42104 | danieljames | 2007-12-16 13:36:50 +0000 (Sun, 16 Dec 2007) | 1 line
Don't include any hash source in tarballs (although I'm including the documentation).
........
r42198 | danieljames | 2007-12-20 10:49:10 +0000 (Thu, 20 Dec 2007) | 1 line
Restore the extra warnings in the unit tests.
........
r42199 | danieljames | 2007-12-20 11:25:38 +0000 (Thu, 20 Dec 2007) | 1 line
Make a cast explicit in order to avoid a warning.
........
r42203 | danieljames | 2007-12-20 15:54:31 +0000 (Thu, 20 Dec 2007) | 1 line
Use 'BOOST_UNORDERED' prefix for macros.
........
r42209 | danieljames | 2007-12-20 19:41:17 +0000 (Thu, 20 Dec 2007) | 1 line
Initialise this branch (hopefully..)
........
r42210 | danieljames | 2007-12-20 19:51:21 +0000 (Thu, 20 Dec 2007) | 1 line
Merge in changes.
........
r42215 | danieljames | 2007-12-20 21:15:42 +0000 (Thu, 20 Dec 2007) | 1 line
Don't add size_type to pointers, cast to difference_type.
........
r42216 | danieljames | 2007-12-20 21:17:38 +0000 (Thu, 20 Dec 2007) | 1 line
I messed up the last commit, this fixes it.
........
r42218 | danieljames | 2007-12-20 21:22:20 +0000 (Thu, 20 Dec 2007) | 1 line
Get rid of last_in_group.
........
r42219 | danieljames | 2007-12-20 21:27:46 +0000 (Thu, 20 Dec 2007) | 1 line
Use node_count to implement group_count.
........
r42231 | danieljames | 2007-12-21 12:04:52 +0000 (Fri, 21 Dec 2007) | 1 line
Some minor changes for Visual C++.
........
r42233 | danieljames | 2007-12-21 19:41:27 +0000 (Fri, 21 Dec 2007) | 1 line
Inline some more methods.
........
r42335 | danieljames | 2007-12-29 13:14:45 +0000 (Sat, 29 Dec 2007) | 3 lines
Some of the changes to the introduction mention in the review. Hopefully this
will make it a little clearer.
........
r42336 | danieljames | 2007-12-29 13:16:55 +0000 (Sat, 29 Dec 2007) | 3 lines
Try to make the buckets explanation a little easier to read. Most of the
changes were based on Jamie Allsop (same for the last commit).
........
r42339 | danieljames | 2007-12-29 16:00:32 +0000 (Sat, 29 Dec 2007) | 1 line
Specify the namespace for 'std::out_of_range' in the reference documentation.
........
r42345 | danieljames | 2007-12-29 20:41:10 +0000 (Sat, 29 Dec 2007) | 8 lines
Rewrite much of the 'controlling the number of buckets' section.
I'm trying to make it clearer. It's a bit tricky as the standard doesn't guarantee much.
Instead of diving straight into the details I have tried to give the reader a rough
idea of what 'rehash' does and what the load factor is. This is hopefully enough to
understand the more detailled discussion of how you can control the number of buckets.
Then finally I discuss iterator invalidation.
........
r42346 | danieljames | 2007-12-29 20:52:22 +0000 (Sat, 29 Dec 2007) | 1 line
Move the table summarizing methods for controlling bucket size next to the discussion of these methods. The paragraphs about insert and invalidating iterator moves on to something else.
........
r42348 | danieljames | 2007-12-29 20:55:30 +0000 (Sat, 29 Dec 2007) | 1 line
Fix the badly marked up bullet points.
........
r42349 | danieljames | 2007-12-29 20:57:53 +0000 (Sat, 29 Dec 2007) | 2 lines
We now have cbegin and cend for local iterators.
........
[SVN r42403]
2008-01-01 20:21:04 +00:00
|
|
|
With this in mind, the __tr1__ introduced the unordered associative containers,
|
|
|
|
which are implemented using hash tables, and they have now been added to the
|
|
|
|
__draft__.
|
2007-05-31 22:33:39 +00:00
|
|
|
|
2007-10-11 23:51:29 +00:00
|
|
|
This library supplies an almost complete implementation of the specification in
|
|
|
|
the __draft__, (it doesn't support `emplace` yet, see the [link
|
|
|
|
unordered.rationale.future_developments Implementation Rationale] section for more
|
|
|
|
details). If accepted the containers should also be added to __boost-tr1__.
|
2007-05-31 22:33:39 +00:00
|
|
|
|
|
|
|
`unordered_set` and `unordered_multiset` are defined in the header
|
|
|
|
<[headerref boost/unordered_set.hpp]>
|
|
|
|
|
|
|
|
namespace boost {
|
|
|
|
template <
|
|
|
|
class Key,
|
Merged revisions 41822-41992,41994-42101 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r41822 | danieljames | 2007-12-07 12:51:54 +0000 (Fri, 07 Dec 2007) | 5 lines
Change the macros to meet boost guidelines.
I should really have done this before the review. At least it'll give them
something to say.
........
r41928 | danieljames | 2007-12-09 19:23:27 +0000 (Sun, 09 Dec 2007) | 1 line
Add some parameters to standalone documentation build.
........
r41929 | danieljames | 2007-12-09 19:24:07 +0000 (Sun, 09 Dec 2007) | 1 line
An extra rehash test for inserting a range.
........
r41930 | danieljames | 2007-12-09 19:24:52 +0000 (Sun, 09 Dec 2007) | 1 line
get_for_erase can be static because all the required information is in the iterator.
........
r41931 | danieljames | 2007-12-09 19:31:00 +0000 (Sun, 09 Dec 2007) | 1 line
ADL doesn't seem to be working properly on Visual C++ 7.1 when calling swap, so workaround this in the compile tests.
........
r41932 | danieljames | 2007-12-09 19:44:46 +0000 (Sun, 09 Dec 2007) | 1 line
Try to make the erase exception requirements a little clearer.
........
r41933 | danieljames | 2007-12-09 19:52:50 +0000 (Sun, 09 Dec 2007) | 1 line
Hopefully clearer comparison of accessors for comparison/hash function objects.
........
r41943 | danieljames | 2007-12-10 00:03:53 +0000 (Mon, 10 Dec 2007) | 1 line
Fix a typo.
........
r41951 | danieljames | 2007-12-10 11:08:02 +0000 (Mon, 10 Dec 2007) | 1 line
Use the locale in the case insensitive comparison, I really should add a test for this.
........
r41994 | danieljames | 2007-12-13 00:26:05 +0000 (Thu, 13 Dec 2007) | 3 lines
Hervé Brönnimann's improved explanation of the formula for avoiding
invalidating iterators.
........
r41995 | danieljames | 2007-12-13 00:30:46 +0000 (Thu, 13 Dec 2007) | 4 lines
Explicity use the classic locale in the case insensitive example. I could make
the locale a member, but that would make the example longer. Also, this would be
a good place to put a note about the need for constant function objects.
........
r41996 | danieljames | 2007-12-13 00:31:55 +0000 (Thu, 13 Dec 2007) | 1 line
Pull the point examples out into test files - fixing a few bugs in the process.
........
r41997 | danieljames | 2007-12-13 00:41:30 +0000 (Thu, 13 Dec 2007) | 3 lines
A few reference links for boost::hash, it might be better to link to the
first page of the Boost.Hash documentation though.
........
r42092 | danieljames | 2007-12-16 10:07:27 +0000 (Sun, 16 Dec 2007) | 2 lines
Fix some typos, and use American spelling.
........
r42093 | danieljames | 2007-12-16 10:11:00 +0000 (Sun, 16 Dec 2007) | 1 line
Small documentation tweak.
........
r42096 | danieljames | 2007-12-16 10:17:03 +0000 (Sun, 16 Dec 2007) | 1 line
Fix some reference documentation errors.
........
r42097 | danieljames | 2007-12-16 10:28:08 +0000 (Sun, 16 Dec 2007) | 1 line
Document the explicit constructors.
........
r42098 | danieljames | 2007-12-16 10:47:13 +0000 (Sun, 16 Dec 2007) | 1 line
Try to make the active issues and proposals a little clearer - including more obvious links to the relevant papers.
........
r42099 | danieljames | 2007-12-16 10:52:30 +0000 (Sun, 16 Dec 2007) | 1 line
Fix some complexity errors in the comparison table.
........
r42100 | danieljames | 2007-12-16 10:59:45 +0000 (Sun, 16 Dec 2007) | 1 line
Use Mapped instead of T in the documentation.
........
r42101 | danieljames | 2007-12-16 11:06:16 +0000 (Sun, 16 Dec 2007) | 1 line
Remove hard-coded length of prime numbers.
........
[SVN r42187]
2007-12-19 23:09:09 +00:00
|
|
|
class Hash = ``[classref boost::hash]``<Key>,
|
2007-05-31 22:33:39 +00:00
|
|
|
class Pred = std::equal_to<Key>,
|
|
|
|
class Alloc = std::allocator<Key> >
|
|
|
|
class ``[classref boost::unordered_set unordered_set]``;
|
|
|
|
|
|
|
|
template<
|
|
|
|
class Key,
|
Merged revisions 41822-41992,41994-42101 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r41822 | danieljames | 2007-12-07 12:51:54 +0000 (Fri, 07 Dec 2007) | 5 lines
Change the macros to meet boost guidelines.
I should really have done this before the review. At least it'll give them
something to say.
........
r41928 | danieljames | 2007-12-09 19:23:27 +0000 (Sun, 09 Dec 2007) | 1 line
Add some parameters to standalone documentation build.
........
r41929 | danieljames | 2007-12-09 19:24:07 +0000 (Sun, 09 Dec 2007) | 1 line
An extra rehash test for inserting a range.
........
r41930 | danieljames | 2007-12-09 19:24:52 +0000 (Sun, 09 Dec 2007) | 1 line
get_for_erase can be static because all the required information is in the iterator.
........
r41931 | danieljames | 2007-12-09 19:31:00 +0000 (Sun, 09 Dec 2007) | 1 line
ADL doesn't seem to be working properly on Visual C++ 7.1 when calling swap, so workaround this in the compile tests.
........
r41932 | danieljames | 2007-12-09 19:44:46 +0000 (Sun, 09 Dec 2007) | 1 line
Try to make the erase exception requirements a little clearer.
........
r41933 | danieljames | 2007-12-09 19:52:50 +0000 (Sun, 09 Dec 2007) | 1 line
Hopefully clearer comparison of accessors for comparison/hash function objects.
........
r41943 | danieljames | 2007-12-10 00:03:53 +0000 (Mon, 10 Dec 2007) | 1 line
Fix a typo.
........
r41951 | danieljames | 2007-12-10 11:08:02 +0000 (Mon, 10 Dec 2007) | 1 line
Use the locale in the case insensitive comparison, I really should add a test for this.
........
r41994 | danieljames | 2007-12-13 00:26:05 +0000 (Thu, 13 Dec 2007) | 3 lines
Hervé Brönnimann's improved explanation of the formula for avoiding
invalidating iterators.
........
r41995 | danieljames | 2007-12-13 00:30:46 +0000 (Thu, 13 Dec 2007) | 4 lines
Explicity use the classic locale in the case insensitive example. I could make
the locale a member, but that would make the example longer. Also, this would be
a good place to put a note about the need for constant function objects.
........
r41996 | danieljames | 2007-12-13 00:31:55 +0000 (Thu, 13 Dec 2007) | 1 line
Pull the point examples out into test files - fixing a few bugs in the process.
........
r41997 | danieljames | 2007-12-13 00:41:30 +0000 (Thu, 13 Dec 2007) | 3 lines
A few reference links for boost::hash, it might be better to link to the
first page of the Boost.Hash documentation though.
........
r42092 | danieljames | 2007-12-16 10:07:27 +0000 (Sun, 16 Dec 2007) | 2 lines
Fix some typos, and use American spelling.
........
r42093 | danieljames | 2007-12-16 10:11:00 +0000 (Sun, 16 Dec 2007) | 1 line
Small documentation tweak.
........
r42096 | danieljames | 2007-12-16 10:17:03 +0000 (Sun, 16 Dec 2007) | 1 line
Fix some reference documentation errors.
........
r42097 | danieljames | 2007-12-16 10:28:08 +0000 (Sun, 16 Dec 2007) | 1 line
Document the explicit constructors.
........
r42098 | danieljames | 2007-12-16 10:47:13 +0000 (Sun, 16 Dec 2007) | 1 line
Try to make the active issues and proposals a little clearer - including more obvious links to the relevant papers.
........
r42099 | danieljames | 2007-12-16 10:52:30 +0000 (Sun, 16 Dec 2007) | 1 line
Fix some complexity errors in the comparison table.
........
r42100 | danieljames | 2007-12-16 10:59:45 +0000 (Sun, 16 Dec 2007) | 1 line
Use Mapped instead of T in the documentation.
........
r42101 | danieljames | 2007-12-16 11:06:16 +0000 (Sun, 16 Dec 2007) | 1 line
Remove hard-coded length of prime numbers.
........
[SVN r42187]
2007-12-19 23:09:09 +00:00
|
|
|
class Hash = ``[classref boost::hash]``<Key>,
|
2007-05-31 22:33:39 +00:00
|
|
|
class Pred = std::equal_to<Key>,
|
|
|
|
class Alloc = std::allocator<Key> >
|
|
|
|
class ``[classref boost::unordered_multiset unordered_multiset]``;
|
|
|
|
}
|
|
|
|
|
|
|
|
`unordered_map` and `unordered_multimap` are defined in the header
|
|
|
|
<[headerref boost/unordered_map.hpp]>
|
|
|
|
|
|
|
|
namespace boost {
|
|
|
|
template <
|
Merged revisions 41822-41992,41994-42101 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r41822 | danieljames | 2007-12-07 12:51:54 +0000 (Fri, 07 Dec 2007) | 5 lines
Change the macros to meet boost guidelines.
I should really have done this before the review. At least it'll give them
something to say.
........
r41928 | danieljames | 2007-12-09 19:23:27 +0000 (Sun, 09 Dec 2007) | 1 line
Add some parameters to standalone documentation build.
........
r41929 | danieljames | 2007-12-09 19:24:07 +0000 (Sun, 09 Dec 2007) | 1 line
An extra rehash test for inserting a range.
........
r41930 | danieljames | 2007-12-09 19:24:52 +0000 (Sun, 09 Dec 2007) | 1 line
get_for_erase can be static because all the required information is in the iterator.
........
r41931 | danieljames | 2007-12-09 19:31:00 +0000 (Sun, 09 Dec 2007) | 1 line
ADL doesn't seem to be working properly on Visual C++ 7.1 when calling swap, so workaround this in the compile tests.
........
r41932 | danieljames | 2007-12-09 19:44:46 +0000 (Sun, 09 Dec 2007) | 1 line
Try to make the erase exception requirements a little clearer.
........
r41933 | danieljames | 2007-12-09 19:52:50 +0000 (Sun, 09 Dec 2007) | 1 line
Hopefully clearer comparison of accessors for comparison/hash function objects.
........
r41943 | danieljames | 2007-12-10 00:03:53 +0000 (Mon, 10 Dec 2007) | 1 line
Fix a typo.
........
r41951 | danieljames | 2007-12-10 11:08:02 +0000 (Mon, 10 Dec 2007) | 1 line
Use the locale in the case insensitive comparison, I really should add a test for this.
........
r41994 | danieljames | 2007-12-13 00:26:05 +0000 (Thu, 13 Dec 2007) | 3 lines
Hervé Brönnimann's improved explanation of the formula for avoiding
invalidating iterators.
........
r41995 | danieljames | 2007-12-13 00:30:46 +0000 (Thu, 13 Dec 2007) | 4 lines
Explicity use the classic locale in the case insensitive example. I could make
the locale a member, but that would make the example longer. Also, this would be
a good place to put a note about the need for constant function objects.
........
r41996 | danieljames | 2007-12-13 00:31:55 +0000 (Thu, 13 Dec 2007) | 1 line
Pull the point examples out into test files - fixing a few bugs in the process.
........
r41997 | danieljames | 2007-12-13 00:41:30 +0000 (Thu, 13 Dec 2007) | 3 lines
A few reference links for boost::hash, it might be better to link to the
first page of the Boost.Hash documentation though.
........
r42092 | danieljames | 2007-12-16 10:07:27 +0000 (Sun, 16 Dec 2007) | 2 lines
Fix some typos, and use American spelling.
........
r42093 | danieljames | 2007-12-16 10:11:00 +0000 (Sun, 16 Dec 2007) | 1 line
Small documentation tweak.
........
r42096 | danieljames | 2007-12-16 10:17:03 +0000 (Sun, 16 Dec 2007) | 1 line
Fix some reference documentation errors.
........
r42097 | danieljames | 2007-12-16 10:28:08 +0000 (Sun, 16 Dec 2007) | 1 line
Document the explicit constructors.
........
r42098 | danieljames | 2007-12-16 10:47:13 +0000 (Sun, 16 Dec 2007) | 1 line
Try to make the active issues and proposals a little clearer - including more obvious links to the relevant papers.
........
r42099 | danieljames | 2007-12-16 10:52:30 +0000 (Sun, 16 Dec 2007) | 1 line
Fix some complexity errors in the comparison table.
........
r42100 | danieljames | 2007-12-16 10:59:45 +0000 (Sun, 16 Dec 2007) | 1 line
Use Mapped instead of T in the documentation.
........
r42101 | danieljames | 2007-12-16 11:06:16 +0000 (Sun, 16 Dec 2007) | 1 line
Remove hard-coded length of prime numbers.
........
[SVN r42187]
2007-12-19 23:09:09 +00:00
|
|
|
class Key, class Mapped,
|
|
|
|
class Hash = ``[classref boost::hash]``<Key>,
|
2007-05-31 22:33:39 +00:00
|
|
|
class Pred = std::equal_to<Key>,
|
|
|
|
class Alloc = std::allocator<Key> >
|
|
|
|
class ``[classref boost::unordered_map unordered_map]``;
|
|
|
|
|
|
|
|
template<
|
Merged revisions 41822-41992,41994-42101 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r41822 | danieljames | 2007-12-07 12:51:54 +0000 (Fri, 07 Dec 2007) | 5 lines
Change the macros to meet boost guidelines.
I should really have done this before the review. At least it'll give them
something to say.
........
r41928 | danieljames | 2007-12-09 19:23:27 +0000 (Sun, 09 Dec 2007) | 1 line
Add some parameters to standalone documentation build.
........
r41929 | danieljames | 2007-12-09 19:24:07 +0000 (Sun, 09 Dec 2007) | 1 line
An extra rehash test for inserting a range.
........
r41930 | danieljames | 2007-12-09 19:24:52 +0000 (Sun, 09 Dec 2007) | 1 line
get_for_erase can be static because all the required information is in the iterator.
........
r41931 | danieljames | 2007-12-09 19:31:00 +0000 (Sun, 09 Dec 2007) | 1 line
ADL doesn't seem to be working properly on Visual C++ 7.1 when calling swap, so workaround this in the compile tests.
........
r41932 | danieljames | 2007-12-09 19:44:46 +0000 (Sun, 09 Dec 2007) | 1 line
Try to make the erase exception requirements a little clearer.
........
r41933 | danieljames | 2007-12-09 19:52:50 +0000 (Sun, 09 Dec 2007) | 1 line
Hopefully clearer comparison of accessors for comparison/hash function objects.
........
r41943 | danieljames | 2007-12-10 00:03:53 +0000 (Mon, 10 Dec 2007) | 1 line
Fix a typo.
........
r41951 | danieljames | 2007-12-10 11:08:02 +0000 (Mon, 10 Dec 2007) | 1 line
Use the locale in the case insensitive comparison, I really should add a test for this.
........
r41994 | danieljames | 2007-12-13 00:26:05 +0000 (Thu, 13 Dec 2007) | 3 lines
Hervé Brönnimann's improved explanation of the formula for avoiding
invalidating iterators.
........
r41995 | danieljames | 2007-12-13 00:30:46 +0000 (Thu, 13 Dec 2007) | 4 lines
Explicity use the classic locale in the case insensitive example. I could make
the locale a member, but that would make the example longer. Also, this would be
a good place to put a note about the need for constant function objects.
........
r41996 | danieljames | 2007-12-13 00:31:55 +0000 (Thu, 13 Dec 2007) | 1 line
Pull the point examples out into test files - fixing a few bugs in the process.
........
r41997 | danieljames | 2007-12-13 00:41:30 +0000 (Thu, 13 Dec 2007) | 3 lines
A few reference links for boost::hash, it might be better to link to the
first page of the Boost.Hash documentation though.
........
r42092 | danieljames | 2007-12-16 10:07:27 +0000 (Sun, 16 Dec 2007) | 2 lines
Fix some typos, and use American spelling.
........
r42093 | danieljames | 2007-12-16 10:11:00 +0000 (Sun, 16 Dec 2007) | 1 line
Small documentation tweak.
........
r42096 | danieljames | 2007-12-16 10:17:03 +0000 (Sun, 16 Dec 2007) | 1 line
Fix some reference documentation errors.
........
r42097 | danieljames | 2007-12-16 10:28:08 +0000 (Sun, 16 Dec 2007) | 1 line
Document the explicit constructors.
........
r42098 | danieljames | 2007-12-16 10:47:13 +0000 (Sun, 16 Dec 2007) | 1 line
Try to make the active issues and proposals a little clearer - including more obvious links to the relevant papers.
........
r42099 | danieljames | 2007-12-16 10:52:30 +0000 (Sun, 16 Dec 2007) | 1 line
Fix some complexity errors in the comparison table.
........
r42100 | danieljames | 2007-12-16 10:59:45 +0000 (Sun, 16 Dec 2007) | 1 line
Use Mapped instead of T in the documentation.
........
r42101 | danieljames | 2007-12-16 11:06:16 +0000 (Sun, 16 Dec 2007) | 1 line
Remove hard-coded length of prime numbers.
........
[SVN r42187]
2007-12-19 23:09:09 +00:00
|
|
|
class Key, class Mapped,
|
|
|
|
class Hash = ``[classref boost::hash]``<Key>,
|
2007-05-31 22:33:39 +00:00
|
|
|
class Pred = std::equal_to<Key>,
|
|
|
|
class Alloc = std::allocator<Key> >
|
|
|
|
class ``[classref boost::unordered_multimap unordered_multimap]``;
|
|
|
|
}
|
|
|
|
|
|
|
|
If using Boost.TR1, these classes will be included from `<unordered_set>` and
|
|
|
|
`<unordered_map>`, with the classes included in the `std::tr1` namespace.
|
|
|
|
|
|
|
|
The containers are used in a similar manner to the normal associative
|
|
|
|
containers:
|
|
|
|
|
|
|
|
#include <``[headerref boost/unordered_map.hpp]``>
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
boost::unordered_map<std::string, int> x;
|
|
|
|
x["one"] = 1;
|
|
|
|
x["two"] = 2;
|
|
|
|
x["three"] = 3;
|
|
|
|
|
|
|
|
assert(x["one"] == 1);
|
|
|
|
assert(x["missing"] == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
But since the elements aren't ordered, the output of:
|
|
|
|
|
|
|
|
BOOST_FOREACH(map::value_type i, x) {
|
|
|
|
std::cout<<i.first<<","<<i.second<<"\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
can be in any order. For example, it might be:
|
|
|
|
|
|
|
|
two,2
|
|
|
|
one,1
|
|
|
|
three,3
|
|
|
|
missing,0
|
|
|
|
|
Merged revisions 41808-41821,41823-41927,41934-41942,41944-41950,41952-41993,41998-42091,42094-42095,42104-42105,42107,42109,42111-42152,42154,42160-42171,42173-42180,42183-42196,42198-42402 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r41993 | danieljames | 2007-12-13 00:23:27 +0000 (Thu, 13 Dec 2007) | 3 lines
Add the hash documentation to the unordered library so that it'll be easier to
link between the libraries.
........
r42104 | danieljames | 2007-12-16 13:36:50 +0000 (Sun, 16 Dec 2007) | 1 line
Don't include any hash source in tarballs (although I'm including the documentation).
........
r42198 | danieljames | 2007-12-20 10:49:10 +0000 (Thu, 20 Dec 2007) | 1 line
Restore the extra warnings in the unit tests.
........
r42199 | danieljames | 2007-12-20 11:25:38 +0000 (Thu, 20 Dec 2007) | 1 line
Make a cast explicit in order to avoid a warning.
........
r42203 | danieljames | 2007-12-20 15:54:31 +0000 (Thu, 20 Dec 2007) | 1 line
Use 'BOOST_UNORDERED' prefix for macros.
........
r42209 | danieljames | 2007-12-20 19:41:17 +0000 (Thu, 20 Dec 2007) | 1 line
Initialise this branch (hopefully..)
........
r42210 | danieljames | 2007-12-20 19:51:21 +0000 (Thu, 20 Dec 2007) | 1 line
Merge in changes.
........
r42215 | danieljames | 2007-12-20 21:15:42 +0000 (Thu, 20 Dec 2007) | 1 line
Don't add size_type to pointers, cast to difference_type.
........
r42216 | danieljames | 2007-12-20 21:17:38 +0000 (Thu, 20 Dec 2007) | 1 line
I messed up the last commit, this fixes it.
........
r42218 | danieljames | 2007-12-20 21:22:20 +0000 (Thu, 20 Dec 2007) | 1 line
Get rid of last_in_group.
........
r42219 | danieljames | 2007-12-20 21:27:46 +0000 (Thu, 20 Dec 2007) | 1 line
Use node_count to implement group_count.
........
r42231 | danieljames | 2007-12-21 12:04:52 +0000 (Fri, 21 Dec 2007) | 1 line
Some minor changes for Visual C++.
........
r42233 | danieljames | 2007-12-21 19:41:27 +0000 (Fri, 21 Dec 2007) | 1 line
Inline some more methods.
........
r42335 | danieljames | 2007-12-29 13:14:45 +0000 (Sat, 29 Dec 2007) | 3 lines
Some of the changes to the introduction mention in the review. Hopefully this
will make it a little clearer.
........
r42336 | danieljames | 2007-12-29 13:16:55 +0000 (Sat, 29 Dec 2007) | 3 lines
Try to make the buckets explanation a little easier to read. Most of the
changes were based on Jamie Allsop (same for the last commit).
........
r42339 | danieljames | 2007-12-29 16:00:32 +0000 (Sat, 29 Dec 2007) | 1 line
Specify the namespace for 'std::out_of_range' in the reference documentation.
........
r42345 | danieljames | 2007-12-29 20:41:10 +0000 (Sat, 29 Dec 2007) | 8 lines
Rewrite much of the 'controlling the number of buckets' section.
I'm trying to make it clearer. It's a bit tricky as the standard doesn't guarantee much.
Instead of diving straight into the details I have tried to give the reader a rough
idea of what 'rehash' does and what the load factor is. This is hopefully enough to
understand the more detailled discussion of how you can control the number of buckets.
Then finally I discuss iterator invalidation.
........
r42346 | danieljames | 2007-12-29 20:52:22 +0000 (Sat, 29 Dec 2007) | 1 line
Move the table summarizing methods for controlling bucket size next to the discussion of these methods. The paragraphs about insert and invalidating iterator moves on to something else.
........
r42348 | danieljames | 2007-12-29 20:55:30 +0000 (Sat, 29 Dec 2007) | 1 line
Fix the badly marked up bullet points.
........
r42349 | danieljames | 2007-12-29 20:57:53 +0000 (Sat, 29 Dec 2007) | 2 lines
We now have cbegin and cend for local iterators.
........
[SVN r42403]
2008-01-01 20:21:04 +00:00
|
|
|
There are other differences, which are listed in the
|
|
|
|
[link unordered.comparison Comparison with Associative Containers] section.
|
2007-05-31 22:33:39 +00:00
|
|
|
|
|
|
|
[endsect]
|