mirror of
https://github.com/boostorg/unordered.git
synced 2025-11-03 01:01:42 +01:00
Import latest changes to the unordered containers. Includes:
Copyright update. Switch back to the version where the sentinel points to itself. Remove alternative versions of swap. Workaround a borland bug or two. More consistent use of class/swap/template. Avoid a few warnings. Add a no-throw swap to the allocator for exception testing. [SVN r3793]
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
[/ 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) ]
|
||||
|
||||
[section:buckets The Data Structure]
|
||||
|
||||
The containers are made up of a number of 'buckets', each of which can contain
|
||||
@@ -6,7 +10,7 @@ boost::unordered_set unordered_set] with 7 buckets containing 5 elements, `A`,
|
||||
`B`, `C`, `D` and `E` (this is just for illustration, in practise containers
|
||||
will have more buckets).
|
||||
|
||||
[$../diagrams/buckets.png]
|
||||
[$../../libs/unordered/doc/diagrams/buckets.png]
|
||||
|
||||
In order to decide which bucket to place an element in, the container applies
|
||||
`Hash` to the element's key (for `unordered_set` and `unordered_multiset` the
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
[/ 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) ]
|
||||
|
||||
[section:comparison Comparison with Associative Containers]
|
||||
|
||||
[table Interface differences.
|
||||
@@ -10,7 +14,10 @@
|
||||
]
|
||||
[
|
||||
[`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()`.\n`Pred` by member typedef `key_equal` and member function `key_eq()`.]
|
||||
[
|
||||
`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()`.]
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
[/ 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) ]
|
||||
|
||||
[section:hash_equality Equality Predicates and Hash Functions]
|
||||
|
||||
[/TODO: A better introduction to hash functions?]
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
[/ 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__
|
||||
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2009.pdf
|
||||
C++ Standard Library Technical Report]]
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
[/ 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 __wang__
|
||||
[@http://www.concentric.net/~Ttwang/tech/inthash.htm
|
||||
Thomas Wang's article on integer hash functions]]
|
||||
@@ -96,14 +100,11 @@ Need to look into this one.
|
||||
[h3 [@http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#431
|
||||
431. Swapping containers with unequal allocators]]
|
||||
|
||||
In a fit of probably unwise enthusiasm, I implemented all the three versions
|
||||
with a macro (BOOST_UNORDERED_SWAP_METHOD) to pick which one is used. As
|
||||
suggested by Howard Hinnant, I set option 3 as the default. I'll probably
|
||||
remove the alternative implementations before review.
|
||||
I'm following Howard Hinnant's advice and implement option 3.
|
||||
|
||||
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.
|
||||
be to double buffer the allocators. But I'm assuming that it won't throw for now.
|
||||
|
||||
[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?]]
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
<!--
|
||||
Copyright Daniel James 2006-2007
|
||||
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)
|
||||
-->
|
||||
|
||||
<library-reference>
|
||||
<!--
|
||||
Header: <boost/unordered_set.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006 Daniel James.
|
||||
// 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)
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
[/ 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) ]
|
||||
|
||||
[library Unordered Associative Containers
|
||||
[quickbook 1.3]
|
||||
[authors [Maitin-Shepard, Jeremy B.], [James, Daniel]]
|
||||
[copyright 2005 2006 Daniel James]
|
||||
[copyright 2005 2007 Daniel James]
|
||||
[purpose std::tr1 compliant hash containers]
|
||||
[id unordered]
|
||||
[dirname unordered]
|
||||
|
||||
Reference in New Issue
Block a user