diff --git a/Jamfile.v2 b/Jamfile.v2 new file mode 100644 index 00000000..f0fbf50b --- /dev/null +++ b/Jamfile.v2 @@ -0,0 +1,14 @@ +# (C) Copyright Daniel James 2005-2006. +# 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) + +project /unordered + : requirements + . + $(BOOST_ROOT) + : usage-requirements + . + $(BOOST_ROOT) + ; + +#use-project /boost/test : $(BOOST_ROOT)/libs/test/build ; diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 4d5c2671..137cc380 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -1,9 +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 ; + ../libs/unordered/doc//unordered + ../libs/unordered/doc//unordered + #../libs/functional/hash/doc//hash + #../libs/functional/hash/doc//hash + + boost.libraries=../../libs/libraries.htm + ; diff --git a/doc/buckets.qbk b/doc/buckets.qbk deleted file mode 100644 index 4fbc6282..00000000 --- a/doc/buckets.qbk +++ /dev/null @@ -1,147 +0,0 @@ -[/ 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 -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, in practise containers -will have more buckets). - -[$../../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 -key is the whole element, but this refered to as the key so that the same -terminology can be used for sets and maps). This gives a `std::size_t`. -`std::size_t` has a much greater range of values then the number of buckets, so -that container applies another transformation to that value to choose a bucket -to place the element in. - -If at a later date the container wants to find an element in the container it -just has to apply the same process to the element's key to discover which -bucket to find it in. This means that you only have to look at the elements -within a single bucket. If the hash function has worked well the elements will -be evenly distributed amongst the buckets. - -You can see in the diagram that `A` & `D` have been placed in the same bucket. -This means that when looking in this bucket, up to 2 comparison have to be -made, making searching slower. This is known as a collision. To keep things -fast we try to keep these to a minimum. - -[table Methods for Accessing Buckets - [[Method] [Description]] - - [ - [``size_type bucket_count() const``] - [The number of buckets.] - ] - [ - [``size_type max_bucket_count() const``] - [An upper bound on the number of buckets.] - ] - [ - [``size_type bucket_size(size_type n) const``] - [The number of elements in bucket `n`.] - ] - [ - [``size_type bucket(key_type const& k) const``] - [Returns the index of the bucket which would contain k] - ] - [ - [`` - local_iterator begin(size_type n); - local_iterator end(size_type n); - const_local_iterator begin(size_type n) const; - const_local_iterator end(size_type n) const; - ``] - [Return begin and end iterators for bucket `n`.] - ] -] - -[h2 Controlling the number of buckets] - -As more elements are added to an unordered associative container, the number -of elements in the buckets will increase causing performance to get worse. To -combat this the containers increase the bucket count as elements are inserted. - -The standard gives you two methods to influence the bucket count. First you can -specify the minimum number of buckets in the constructor, and later, by calling -`rehash`. - -The other method is the `max_load_factor` member function. The 'load factor' -is the average number of elements per bucket, `max_load_factor` can be used -to give a /hint/ of a value that the load factor should be kept below. The -draft standard doesn't actually require the container to pay much attention -to this value. The only time the load factor is /required/ to be less than the -maximum is following a call to `rehash`. But most implementations will probably -try to keep the number of elements below the max load factor, and set the -maximum load factor something the same or near to your hint - unless your hint -is unreasonably small. - -It is not specified anywhere how member functions other than `rehash` affect -the bucket count, although `insert` is only allowed to invalidate iterators -when the insertion causes the load factor to reach the maximum. Which will -typically mean that insert will only change the number of buckets when an -insert causes this. - -In a similar manner to using `reserve` for `vector`s, it can be a good idea -to call `rehash` before inserting a large number of elements. This will get -the expensive rehashing out of the way and let you store iterators, safe in -the knowledge that they won't be invalidated. If you are inserting `n` -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` 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]] - - [ - [``float load_factor() const``] - [The average number of elements per bucket.] - ] - [ - [``float max_load_factor() const``] - [Returns the current maximum load factor.] - ] - [ - [``float max_load_factor(float z)``] - [Changes the container's maximum load factor, using `z` as a hint.] - ] - [ - [``void rehash(size_type n)``] - [Changes the number of buckets so that there at least n buckets, and - so that the load factor is less than the maximum load factor.] - ] - -] - -[/ I'm not at all happy with this section. So I've commented it out.] - -[/ h2 Rehash Techniques] - -[/If the container has a load factor much smaller than the maximum, `rehash` -might decrease the number of buckets, reducing the memory usage. This isn't -guaranteed by the standard but this implementation will do it. - -If you want to stop the table from ever rehashing due to an insert, you can -set the maximum load factor to infinity (or perhaps a load factor that it'll -never reach - say `x.max_size()`. As you can only give a 'hint' for the maximum -load factor, this isn't guaranteed to work. But again, it'll work in this -implementation. (TODO: If an unordered container with infinite load factor -is copied, bad things could happen. So maybe this advice should be removed. Or -maybe the implementation should cope with that). - -If you do this and want to make the container rehash, `rehash` will still work. -But be careful that you only ever call it with a sufficient number of buckets -- otherwise it's very likely that the container will decrease the bucket -count to an overly small amount.] - -[endsect] diff --git a/doc/comparison.qbk b/doc/comparison.qbk deleted file mode 100644 index 532e63b0..00000000 --- a/doc/comparison.qbk +++ /dev/null @@ -1,162 +0,0 @@ -[/ 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. - [[Associative Containers] [Unordered Associative Containers]] - - [ - [Parameterized by an ordering relation `Compare`] - [Parameterized by a function object `Hash` and an equivalence relation - `Pred`] - ] - [ - [`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()`.] - ] - [ - [Member typedef `value_compare` supplies an ordering comparison for member elements, accessed by member function `value_comp()`.] - [No equivalent. No idea why.] - ] - [/TODO: Mention a range? This is meant to be differences but this doesn't - seem to be complete.] - [ - [Constructors have optional extra parameters for the comparison object.] - [Constructors have optional extra parameters for the initial minimum - number of buckets, a hash function and an equality object.] - ] - - [ - [Keys `k1`, `k2` are considered equivalent if - `!Compare(k1, k2) && !Compare(k2, k1)`] - [Keys `k1`, `k2` are considered equivalent if `Pred(k1, k2)`] - ] - [ - [Member function `lower_bound(k)` and `upper_bound(k)`] - [No equivalent. Since the elements aren't ordered `lower_bound` and - `upper_bound` would be meaningless.] - ] - [ - [`equal_range(k)` returns an empty range at the position that k - would be inserted if k isn't present in the container.] - [`equal_range(k)` returns a range at the end of the container if - k isn't present in the container. It can't return a positioned - range as k could be inserted into multiple place. To find out the - bucket that k would be inserted into use `bucket(k)`. But remember - that an insert can cause the container to rehash - meaning that the - element can be inserted into a different bucket.] - ] - [ - [`iterator`, `const_iterator` are of the biderctional category.] - [`iterator`, `const_iterator` are of at least the forward category.] - ] - [ - [Inserts do not invalidate iterators or references to the container.] - [Inserts can invalidate iterators but not references to the container.] - ] - [ - [Iterators iterate through the container in the order defined by - the comparison object.] - [Iterators iterate through the container in an arbitrary order, that - can change as elements are inserted. Although, equivalent elements - are always adjacent.] - ] - [ - [No equivalent] - [Local iterators can be used to iterate through individual buckets. - (I don't think that the order of local iterators and iterators are - required to have any correspondence.)] - ] - [ - [Can be compared using the `==`, `!=`, `<`, `<=`, `>`, `>=` operators] - [No comparison operators are defined] - ] - [ - [] - [When inserting with a hint, implementations are permitted to ignore - the hint.] - ] - [ - [`erase` never throws an exception] - [The containers hash or predicate function can throw exceptions - from `erase`] - ] -] - -[table Complexity Guarantess - [[Operation] [Associative Containers] [Unordered Associative Containers]] - [ - [Construction of empty container] - [constant] - [/TODO: Do I meet this?] - [O(/n/) where /n/ is the minimum number of buckets.] - ] - [ - [Construction of container from a range of /N/ elements] - [O(/N/ log /N/), O(/N/) if the range is sorted with `value_comp()`] - [Average case O(/N/), worst case - O(/N/'''2''')] - ] - [ - [Insert a single element] - [logarithmic] - [Average case constant, worst case linear] - ] - [ - [Insert a single element with a hint] - [Amortized 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()')] - ] - [ - [Erase by key, `k`] - [O(log(`size()`) + `count(k)`)] - [Average case: O(`count(k)`), Worst case: O(`size()`)] - ] - [ - [Erase a single element by iterator] - [Amortized constant] - [Average case: O(1), Worst case: O(`size()`)] - ] - [ - [Erase a range of /N/ elements] - [O(log(`size()`) + /N/)] - [Average case: O(/N/), Worst case: O(`size()`)] - ] - [ - [Clearing the container] - [O(`size()`)] - [O(`size()`)] - ] - [ - [Find] - [logarithmic] - [Average case: O(/N/), Worst case: O(`size()`)] - ] - [/ TODO: Average case is probably wrong. ] - [ - [Count] - [O(log(`size()`) + `count(k)`)] - [Average case: O(1), Worst case: O(`size()`)] - ] - [ - [`equal_range(k)`] - [logarithmic] - [Average case: O(`count(k)`), Worst case: O(`size()`)] - ] - [ - [`lower_bound`,`upper_bound`] - [logarithmic] - [n/a] - ] -] - -[endsect] diff --git a/doc/diagrams/buckets.dia b/doc/diagrams/buckets.dia deleted file mode 100644 index f5e76e69..00000000 Binary files a/doc/diagrams/buckets.dia and /dev/null differ diff --git a/doc/diagrams/buckets.png b/doc/diagrams/buckets.png deleted file mode 100644 index 20267320..00000000 Binary files a/doc/diagrams/buckets.png and /dev/null differ diff --git a/doc/hash_equality.qbk b/doc/hash_equality.qbk deleted file mode 100644 index 9fdbb798..00000000 --- a/doc/hash_equality.qbk +++ /dev/null @@ -1,140 +0,0 @@ -[/ 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?] - -While the associative containers use an ordering relation to specify how the -elements are stored, the unordered associative containers use an equality -predicate and a hash function. For example [classref boost::unordered_set] -is declared as: - - template, - typename Pred = std::equal_to, - typename Alloc = std::allocator > - 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 behaviour -of the equality predicate you would have to change the hash function to match -it. - -For example, if you wanted to use the -[@http://www.isthe.com/chongo/tech/comp/fnv/ FNV-1 hash] you could write: - - ``[classref boost::unordered_set]`` words; - -An example implementation of FNV-1, and some other hash functions are supplied -in the examples directory. - -Alternatively, you might wish to use a different equality function. If so, make -sure you use a hash function that matches it. For example, a -case-insensitive dictionary: - - struct iequal_to - : std::binary_function - { - bool operator()(std::string const& x, - std::string const& y) const - { - return boost::algorithm::iequals(x, y); - } - }; - - struct ihash - : std::unary_function - { - bool operator()(std::string const& x) const - { - std::size_t seed = 0; - - for(std::string::const_iterator it = x.begin(); - it != x.end(); ++it) - { - boost::hash_combine(seed, std::toupper(*it)); - } - - return seed; - } - }; - - struct word_info; - - boost::unordered_map - idictionary; - -A more generic version of this example is available at: -[@../../libs/unordered/examples/case_insensitive.hpp /libs/unordered/examples/case_insensitive.hpp] - -[h2 Custom Types] - -Similarly, a custom hash function can be used for custom types: - - struct point { - int x; - int y; - }; - - bool operator==(point const& p1, point const& p2) - { - return p1.x == p2.x && p1.y == p2.y; - } - - struct point_hash - : std::unary_function - { - 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_hash> - points; - -Although, customizing 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 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 -implementations of the unordered associative containers. - -[table Methods for accessing the hash and euqality functions. - [[Method] [Description]] - - [ - [``hasher hash_function() const``] - [Returns the container's hash function.] - ] - [ - [``key_equal key_eq() const``] - [Returns the container's key equality function.] - ] -] - -[endsect] diff --git a/doc/intro.qbk b/doc/intro.qbk deleted file mode 100644 index d6e290ff..00000000 --- a/doc/intro.qbk +++ /dev/null @@ -1,98 +0,0 @@ -[/ 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]] -[def __draft__ - [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2009.pdf - 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 keys, the C++ standard library offers `std::set`, -`std::map`, `std::multiset` and `std::multimap`. These are generally -implemented using balanced binary trees so lookup time has -logarithmic complexity. Which 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 -or isn't practicle. For a hash table you need an equality function -and a hash function for the key. - -So the __tr1__ introduced the unordered associative containers, which are -implemented using hash tables, and they have now been added to the __draft__. -There are four containers to match the existing -associate containers. In the header <[headerref boost/unordered_set.hpp]>: - - template < - class Key, - class Hash = boost::hash, - class Pred = std::equal_to, - class Alloc = std::allocator > - class ``[classref boost::unordered_set unordered_set]``; - - template< - class Key, - class Hash = boost::hash, - class Pred = std::equal_to, - class Alloc = std::allocator > - class ``[classref boost::unordered_multiset unordered_multiset]``; - -and in <[headerref boost/unordered_map.hpp]>: - - template < - class Key, class T, - class Hash = boost::hash, - class Pred = std::equal_to, - class Alloc = std::allocator > - class ``[classref boost::unordered_map unordered_map]``; - - template< - class Key, class T, - class Hash = boost::hash, - class Pred = std::equal_to, - class Alloc = std::allocator > - class ``[classref boost::unordered_multimap unordered_multimap]``; - -The containers are used in a similar manner to the normal associative -containers: - - #include <``[headerref boost/unordered_map.hpp]``> - #include - - int main() - { - boost::unordered_map 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< - - - - -
- - - - - - - An unordered associative container that stores unique values. - - - For the normative reference see chapter 23 of - the working draft of the C++ standard [n2009]. - - - - Template Parameters - - - - - - Value - - Value must be Assignable and CopyConstructible - - - - - Hash - - A unary function object type that acts a hash function for a Value. It takes a single argument of type Value and returns a value of type std::size_t. - - - - - Pred - - A binary function object that implements an equivalence relation on values of type Value. A binary function object that induces an equivalence relation on values of type Key. It takes two arguments of type Key and returns a value of type bool. - - - - - Alloc - - An allocator whose value type is the same as the container's value type. - - - - - - - The elements are organized into buckets. Keys with the same hash code are stored in the same bucket. - - The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash. - - - - Value - - - Value - - - Hash - - - Pred - - - Alloc - - - typename allocator_type::pointer - - - typename allocator_type::const_pointer - - - typename allocator_type::reference - - lvalue of - value_type. - - - - - typename allocator_type::const_reference - - const lvalue of - value_type. - - - - - implementation-defined - unsigned integral type - - size_type can represent any non-negative value of - difference_type. - - - - - implementation-defined - signed integral type - Is identical to the difference type of - iterator and - const_iterator. - - - - - implementation-defined - - A constant iterator whose value type is - value_type. - - - Any iterator category except output iterator. - - Convertible to - const_iterator. - - - - - - implementation-defined - A constant iterator whose value type is - value_type. - - Any iterator category except output iterator. - - - - - - implementation-defined - An iterator with the same value type, difference type and pointer and reference type as - iterator. - - A local_iterator object can be used to iterate through a single bucket. - - - - implementation-defined - A constant iterator with the same value type, difference type and pointer and reference type as - const_iterator. - - A const_local_iterator object can be used to iterate through a single bucket. - - - - - size_type - implementation-defined - - - hasher const& - hasher() - - - key_equal const& - key_equal() - - - allocator_type const& - allocator_type() - - - size() == 0 - - - 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. - - - - - - - InputIterator - - - InputIterator - - - size_type - implementation-defined - - - hasher const& - hasher() - - - key_equal const& - key_equal() - - - allocator_type const& - allocator_type() - - - 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 and inserts the elements from [f, l) into it. - - - - - - unordered_set const& - - - The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator. - - - - - - - - unordered_set const& - - unordered_set& - - The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator. - - - - - allocator_type - - - - bool - - size() == 0 - - - - size_type - - std::distance(begin(), end()) - - - - size_type - size() of the largest possible container. - - - - - - iterator - const_iterator - An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. - - - - - iterator - - - const_iterator - - An iterator which refers to the past-the-end value for the container. - - - - const_iterator - A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. - - - - const_iterator - A constant iterator which refers to the past-the-end value for the container. - - - - - - size_type - std::distance(begin(), end()) - - - - - value_type const& - - std::pair<iterator, bool> - - Inserts obj in the container if and only if there is no element in the container with an equivalent value. - - - - The bool component of the return type is true if an insert took place. - - If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the elment with equivalent value. - - - - If an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - iterator - - - value_type const& - - iterator - - - - const_iterator - - - value_type const& - - const_iterator - - - Inserts obj in the container if and only if there is no element in the container with an equivalent value. - - hint is a suggestion to where the element should be inserted. - - - - If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the elment with equivalent value. - - - - If an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - In this implementation, iterator and const_iterator are the same type, so a single overload is defined to implement both signatures. - - - - - - - InputIterator - - - InputIterator - - void - - Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent value. - - - - When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - iterator - - iterator - - - - const_iterator - - const_iterator - - - Erase the element pointed to by position. - - - - The iterator following position before the erasure. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - They don't get called by the current implementation Boost.Unordered but other implementations may call them. - - - - In this implementation, iterator and const_iterator are the same type, so a single overload is defined to implement both signatures. - - - - - - - key_type const& - - size_type - - - Erase all elements with key equivalent to k. - - - - The number of elements erased. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - - - - - - iterator - - - iterator - - iterator - - - - const_iterator - - - const_iterator - - const_iterator - - - Erases the elements in the range from first to last. - - - - The iterator following the erased elements - i.e. last. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - They don't get called by the current implementation Boost.Unordered but other implementations may call them. - - - - - void - - Erases all elements in the container. - - - - size() == 0 - - - - Never throws an exception. - - - - - - unordered_set& - - void - - Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. - - - - - - - hasher - The container's hash function. - - - - key_equal - The container's key equality predicate. - - - - - - - - key_type const& - - iterator - - - - key_type const& - - iterator - - - An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists. - - - - - - key_type const& - - size_type - - The number of elements with key equivalent to k. - - - - - - - key_type const& - - std::pair<iterator, iterator> - - - - key_type const& - - std::pair<iterator, iterator> - - - A range with containing all elements with key equivalent to k. If the container doesn't container any such elements, returns std::make_pair(b.end(),b.end()). - - - - - - - size_type - - The number of buckets. - - - - - size_type - - An upper bound on the number of buckets. - - - - - - size_type - - size_type - - - n < bucket_count() - - - - The number of elements in bucket - n. - - - - - - key_type const& - - size_type - - The index of the bucket which would contain an element with key k. - - - - The return value is less than bucket_count() - - - - - - - size_type - - local_iterator - - - - size_type - - const_local_iterator - - - n shall be in the range - [0, bucket_count()). - - - - A local iterator pointing the first element in the bucket with index n. - - - - - - - size_type - - local_iterator - - - - size_type - - const_local_iterator - - - n shall be in the range - [0, bucket_count()). - - - - A local iterator pointing the 'one past the end' element in the bucket with index n. - - - - - - - float - - The average number of elements per bucket. - - - - - float - - Returns the current maximum load factor. - - - - - - float - - float - - Changes the container's maximum load factor, using z as a hint. - - - - - - size_type - - void - - Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor. - - Invalidates iterators, and changes the order of elements - - - - The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function. - - - - - - - - - unordered_set<Key, T, Hash, Pred, Alloc>& - - - unordered_set<Key, T, Hash, Pred, Alloc>& - - void - - x.swap(y) - - - - Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred. - - - - - - - - - An unordered associative container that stores values. The same key can be stored multiple times. - - - For the normative reference see chapter 23 of - the working draft of the C++ standard [n2009]. - - - - Template Parameters - - - - - - Value - - Value must be Assignable and CopyConstructible - - - - - Hash - - A unary function object type that acts a hash function for a Value. It takes a single argument of type Value and returns a value of type std::size_t. - - - - - Pred - - A binary function object that implements an equivalence relation on values of type Value. A binary function object that induces an equivalence relation on values of type Key. It takes two arguments of type Key and returns a value of type bool. - - - - - Alloc - - An allocator whose value type is the same as the container's value type. - - - - - - - The elements are organized into buckets. Keys with the same hash code are stored in the same bucket and elements with equivalent keys are stored next to each other. - - The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash. - - - - Value - - - Value - - - Hash - - - Pred - - - Alloc - - - typename allocator_type::pointer - - - typename allocator_type::const_pointer - - - typename allocator_type::reference - - lvalue of - value_type. - - - - - typename allocator_type::const_reference - - const lvalue of - value_type. - - - - - implementation-defined - unsigned integral type - - size_type can represent any non-negative value of - difference_type. - - - - - implementation-defined - signed integral type - Is identical to the difference type of - iterator and - const_iterator. - - - - - implementation-defined - - A constant iterator whose value type is - value_type. - - - Any iterator category except output iterator. - - Convertible to - const_iterator. - - - - - - implementation-defined - A constant iterator whose value type is - value_type. - - Any iterator category except output iterator. - - - - - - implementation-defined - An iterator with the same value type, difference type and pointer and reference type as - iterator. - - A local_iterator object can be used to iterate through a single bucket. - - - - implementation-defined - A constant iterator with the same value type, difference type and pointer and reference type as - const_iterator. - - A const_local_iterator object can be used to iterate through a single bucket. - - - - - size_type - implementation-defined - - - hasher const& - hasher() - - - key_equal const& - key_equal() - - - allocator_type const& - allocator_type() - - - size() == 0 - - - 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. - - - - - - - InputIterator - - - InputIterator - - - size_type - implementation-defined - - - hasher const& - hasher() - - - key_equal const& - key_equal() - - - allocator_type const& - allocator_type() - - - 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 and inserts the elements from [f, l) into it. - - - - - - unordered_multiset const& - - - The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator. - - - - - - - - unordered_multiset const& - - unordered_multiset& - - The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator. - - - - - allocator_type - - - - bool - - size() == 0 - - - - size_type - - std::distance(begin(), end()) - - - - size_type - size() of the largest possible container. - - - - - - iterator - const_iterator - An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. - - - - - iterator - - - const_iterator - - An iterator which refers to the past-the-end value for the container. - - - - const_iterator - A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. - - - - const_iterator - A constant iterator which refers to the past-the-end value for the container. - - - - - - size_type - std::distance(begin(), end()) - - - - - value_type const& - - iterator - - Inserts obj in the container. - - - - An iterator pointing to the inserted element. - - - - If an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - iterator - - - value_type const& - - iterator - - - - const_iterator - - - value_type const& - - const_iterator - - - Inserts obj in the container. - - hint is a suggestion to where the element should be inserted. - - - - An iterator pointing to the inserted element. - - - - If an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - InputIterator - - - InputIterator - - void - - Inserts a range of elements into the container. - - - - When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - iterator - - iterator - - - - const_iterator - - const_iterator - - - Erase the element pointed to by position. - - - - The iterator following position before the erasure. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - They don't get called by the current implementation Boost.Unordered but other implementations may call them. - - - - - - - - - key_type const& - - size_type - - - Erase all elements with key equivalent to k. - - - - The number of elements erased. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - - - - - - iterator - - - iterator - - iterator - - - - const_iterator - - - const_iterator - - const_iterator - - - Erases the elements in the range from first to last. - - - - The iterator following the erased elements - i.e. last. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - They don't get called by the current implementation Boost.Unordered but other implementations may call them. - - - - - void - - Erases all elements in the container. - - - - size() == 0 - - - - Never throws an exception. - - - - - - unordered_multiset& - - void - - Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. - - - - - - - hasher - The container's hash function. - - - - key_equal - The container's key equality predicate. - - - - - - - - key_type const& - - iterator - - - - key_type const& - - iterator - - - An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists. - - - - - - key_type const& - - size_type - - The number of elements with key equivalent to k. - - - - - - - key_type const& - - std::pair<iterator, iterator> - - - - key_type const& - - std::pair<iterator, iterator> - - - A range with containing all elements with key equivalent to k. If the container doesn't container any such elements, returns std::make_pair(b.end(),b.end()). - - - - - - - size_type - - The number of buckets. - - - - - size_type - - An upper bound on the number of buckets. - - - - - - size_type - - size_type - - - n < bucket_count() - - - - The number of elements in bucket - n. - - - - - - key_type const& - - size_type - - The index of the bucket which would contain an element with key k. - - - - The return value is less than bucket_count() - - - - - - - size_type - - local_iterator - - - - size_type - - const_local_iterator - - - n shall be in the range - [0, bucket_count()). - - - - A local iterator pointing the first element in the bucket with index n. - - - - - - - size_type - - local_iterator - - - - size_type - - const_local_iterator - - - n shall be in the range - [0, bucket_count()). - - - - A local iterator pointing the 'one past the end' element in the bucket with index n. - - - - - - - float - - The average number of elements per bucket. - - - - - float - - Returns the current maximum load factor. - - - - - - float - - float - - Changes the container's maximum load factor, using z as a hint. - - - - - - size_type - - void - - Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor. - - Invalidates iterators, and changes the order of elements - - - - The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function. - - - - - - - - - unordered_multiset<Key, T, Hash, Pred, Alloc>& - - - unordered_multiset<Key, T, Hash, Pred, Alloc>& - - void - - x.swap(y) - - - - Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred. - - - - -
- - -
- - - - - - - An unordered associative container that associates unique keys with another value. - - - For the normative reference see chapter 23 of - the working draft of the C++ standard [n2009]. - - - - Template Parameters - - - - - - Key - - Key must be Assignable and CopyConstructible. - - - - - T - - T must be CopyConstructible - - - - - Hash - - A unary function object type that acts a hash function for a Key. It takes a single argument of type Key and returns a value of type std::size_t. - - - - - Pred - - A binary function object that implements an equivalence relation on values of type Key. A binary function object that induces an equivalence relation on values of type Key. It takes two arguments of type Key and returns a value of type bool. - - - - - Alloc - - An allocator whose value type is the same as the container's value type. - - - - - - - The elements are organized into buckets. Keys with the same hash code are stored in the same bucket. - - The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash. - - - - Key - - - std::pair<Key const, Value> - - - T - - - Hash - - - Pred - - - Alloc - - - typename allocator_type::pointer - - - typename allocator_type::const_pointer - - - typename allocator_type::reference - - lvalue of - value_type. - - - - - typename allocator_type::const_reference - - const lvalue of - value_type. - - - - - implementation-defined - unsigned integral type - - size_type can represent any non-negative value of - difference_type. - - - - - implementation-defined - signed integral type - Is identical to the difference type of - iterator and - const_iterator. - - - - - implementation-defined - - A iterator whose value type is - value_type. - - - Any iterator category except output iterator. - - Convertible to - const_iterator. - - - - - - implementation-defined - A constant iterator whose value type is - value_type. - - Any iterator category except output iterator. - - - - - - implementation-defined - An iterator with the same value type, difference type and pointer and reference type as - iterator. - - A local_iterator object can be used to iterate through a single bucket. - - - - implementation-defined - A constant iterator with the same value type, difference type and pointer and reference type as - const_iterator. - - A const_local_iterator object can be used to iterate through a single bucket. - - - - - size_type - implementation-defined - - - hasher const& - hasher() - - - key_equal const& - key_equal() - - - allocator_type const& - allocator_type() - - - size() == 0 - - - 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. - - - - - - - InputIterator - - - InputIterator - - - size_type - implementation-defined - - - hasher const& - hasher() - - - key_equal const& - key_equal() - - - allocator_type const& - allocator_type() - - - 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 and inserts the elements from [f, l) into it. - - - - - - unordered_map const& - - - The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator. - - - - - - - - unordered_map const& - - unordered_map& - - The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator. - - - - - allocator_type - - - - bool - - size() == 0 - - - - size_type - - std::distance(begin(), end()) - - - - size_type - size() of the largest possible container. - - - - - - iterator - const_iterator - An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. - - - - - iterator - - - const_iterator - - An iterator which refers to the past-the-end value for the container. - - - - const_iterator - A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. - - - - const_iterator - A constant iterator which refers to the past-the-end value for the container. - - - - - - size_type - std::distance(begin(), end()) - - - - - value_type const& - - std::pair<iterator, bool> - - Inserts obj in the container if and only if there is no element in the container with an equivalent key. - - - - The bool component of the return type is true if an insert took place. - - If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the elment with equivalent key. - - - - If an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - iterator - - - value_type const& - - iterator - - - - const_iterator - - - value_type const& - - const_iterator - - - Inserts obj in the container if and only if there is no element in the container with an equivalent key. - - hint is a suggestion to where the element should be inserted. - - - - If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the elment with equivalent key. - - - - If an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - In this implementation, iterator and const_iterator are the same type, so a single overload is defined to implement both signatures. - - - - - - - InputIterator - - - InputIterator - - void - - Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent key. - - - - When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - iterator - - iterator - - - - const_iterator - - const_iterator - - - Erase the element pointed to by position. - - - - The iterator following position before the erasure. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - They don't get called by the current implementation Boost.Unordered but other implementations may call them. - - - - In this implementation, iterator and const_iterator are the same type, so a single overload is defined to implement both signatures. - - - - - - - key_type const& - - size_type - - - Erase all elements with key equivalent to k. - - - - The number of elements erased. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - - - - - - iterator - - - iterator - - iterator - - - - const_iterator - - - const_iterator - - const_iterator - - - Erases the elements in the range from first to last. - - - - The iterator following the erased elements - i.e. last. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - They don't get called by the current implementation Boost.Unordered but other implementations may call them. - - - - - void - - Erases all elements in the container. - - - - size() == 0 - - - - Never throws an exception. - - - - - - unordered_map& - - void - - Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. - - - - - - - hasher - The container's hash function. - - - - key_equal - The container's key equality predicate. - - - - - - - - key_type const& - - iterator - - - - key_type const& - - iterator - - - An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists. - - - - - - key_type const& - - size_type - - The number of elements with key equivalent to k. - - - - - - - key_type const& - - std::pair<iterator, iterator> - - - - key_type const& - - std::pair<iterator, iterator> - - - A range with containing all elements with key equivalent to k. If the container doesn't container any such elements, returns std::make_pair(b.end(),b.end()). - - - - - - key_type const& - - mapped_type& - - If the container does not already contain an elements with a key equivalent to k, inserts the value std::pair<key_type const, mapped_type>(k, mapped_type()) - - - - A reference to x.second where x is the element already in the container, or the newly inserted element with a key equivalent to k - - - - If an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - size_type - - The number of buckets. - - - - - size_type - - An upper bound on the number of buckets. - - - - - - size_type - - size_type - - - n < bucket_count() - - - - The number of elements in bucket - n. - - - - - - key_type const& - - size_type - - The index of the bucket which would contain an element with key k. - - - - The return value is less than bucket_count() - - - - - - - size_type - - local_iterator - - - - size_type - - const_local_iterator - - - n shall be in the range - [0, bucket_count()). - - - - A local iterator pointing the first element in the bucket with index n. - - - - - - - size_type - - local_iterator - - - - size_type - - const_local_iterator - - - n shall be in the range - [0, bucket_count()). - - - - A local iterator pointing the 'one past the end' element in the bucket with index n. - - - - - - - float - - The average number of elements per bucket. - - - - - float - - Returns the current maximum load factor. - - - - - - float - - float - - Changes the container's maximum load factor, using z as a hint. - - - - - - size_type - - void - - Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor. - - Invalidates iterators, and changes the order of elements - - - - The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function. - - - - - - - - - unordered_map<Key, T, Hash, Pred, Alloc>& - - - unordered_map<Key, T, Hash, Pred, Alloc>& - - void - - x.swap(y) - - - - Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred. - - - - - - - - - An unordered associative container that associates keys with another value. The same key can be stored multiple times. - - - For the normative reference see chapter 23 of - the working draft of the C++ standard [n2009]. - - - - Template Parameters - - - - - - Key - - Key must be Assignable and CopyConstructible. - - - - - T - - T must be CopyConstructible - - - - - Hash - - A unary function object type that acts a hash function for a Key. It takes a single argument of type Key and returns a value of type std::size_t. - - - - - Pred - - A binary function object that implements an equivalence relation on values of type Key. A binary function object that induces an equivalence relation on values of type Key. It takes two arguments of type Key and returns a value of type bool. - - - - - Alloc - - An allocator whose value type is the same as the container's value type. - - - - - - - The elements are organized into buckets. Keys with the same hash code are stored in the same bucket and elements with equivalent keys are stored next to each other. - - The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash. - - - - Key - - - std::pair<Key const, Value> - - - T - - - Hash - - - Pred - - - Alloc - - - typename allocator_type::pointer - - - typename allocator_type::const_pointer - - - typename allocator_type::reference - - lvalue of - value_type. - - - - - typename allocator_type::const_reference - - const lvalue of - value_type. - - - - - implementation-defined - unsigned integral type - - size_type can represent any non-negative value of - difference_type. - - - - - implementation-defined - signed integral type - Is identical to the difference type of - iterator and - const_iterator. - - - - - implementation-defined - - A iterator whose value type is - value_type. - - - Any iterator category except output iterator. - - Convertible to - const_iterator. - - - - - - implementation-defined - A constant iterator whose value type is - value_type. - - Any iterator category except output iterator. - - - - - - implementation-defined - An iterator with the same value type, difference type and pointer and reference type as - iterator. - - A local_iterator object can be used to iterate through a single bucket. - - - - implementation-defined - A constant iterator with the same value type, difference type and pointer and reference type as - const_iterator. - - A const_local_iterator object can be used to iterate through a single bucket. - - - - - size_type - implementation-defined - - - hasher const& - hasher() - - - key_equal const& - key_equal() - - - allocator_type const& - allocator_type() - - - size() == 0 - - - 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. - - - - - - - InputIterator - - - InputIterator - - - size_type - implementation-defined - - - hasher const& - hasher() - - - key_equal const& - key_equal() - - - allocator_type const& - allocator_type() - - - 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 and inserts the elements from [f, l) into it. - - - - - - unordered_multimap const& - - - The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator. - - - - - - - - unordered_multimap const& - - unordered_multimap& - - The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator. - - - - - allocator_type - - - - bool - - size() == 0 - - - - size_type - - std::distance(begin(), end()) - - - - size_type - size() of the largest possible container. - - - - - - iterator - const_iterator - An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. - - - - - iterator - - - const_iterator - - An iterator which refers to the past-the-end value for the container. - - - - const_iterator - A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container. - - - - const_iterator - A constant iterator which refers to the past-the-end value for the container. - - - - - - size_type - std::distance(begin(), end()) - - - - - value_type const& - - iterator - - Inserts obj in the container. - - - - An iterator pointing to the inserted element. - - - - If an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - iterator - - - value_type const& - - iterator - - - - const_iterator - - - value_type const& - - const_iterator - - - Inserts obj in the container. - - hint is a suggestion to where the element should be inserted. - - - - An iterator pointing to the inserted element. - - - - If an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - InputIterator - - - InputIterator - - void - - Inserts a range of elements into the container. - - - - When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect. - - - - Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. - - - - - - - iterator - - iterator - - - - const_iterator - - const_iterator - - - Erase the element pointed to by position. - - - - The iterator following position before the erasure. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - They don't get called by the current implementation Boost.Unordered but other implementations may call them. - - - - - - - - - key_type const& - - size_type - - - Erase all elements with key equivalent to k. - - - - The number of elements erased. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - - - - - - iterator - - - iterator - - iterator - - - - const_iterator - - - const_iterator - - const_iterator - - - Erases the elements in the range from first to last. - - - - The iterator following the erased elements - i.e. last. - - - - Only throws an exception, if it is thrown by a call to hasher or key_equal. - - They don't get called by the current implementation Boost.Unordered but other implementations may call them. - - - - - void - - Erases all elements in the container. - - - - size() == 0 - - - - Never throws an exception. - - - - - - unordered_multimap& - - void - - Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher. - - - - - - - hasher - The container's hash function. - - - - key_equal - The container's key equality predicate. - - - - - - - - key_type const& - - iterator - - - - key_type const& - - iterator - - - An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists. - - - - - - key_type const& - - size_type - - The number of elements with key equivalent to k. - - - - - - - key_type const& - - std::pair<iterator, iterator> - - - - key_type const& - - std::pair<iterator, iterator> - - - A range with containing all elements with key equivalent to k. If the container doesn't container any such elements, returns std::make_pair(b.end(),b.end()). - - - - - - - size_type - - The number of buckets. - - - - - size_type - - An upper bound on the number of buckets. - - - - - - size_type - - size_type - - - n < bucket_count() - - - - The number of elements in bucket - n. - - - - - - key_type const& - - size_type - - The index of the bucket which would contain an element with key k. - - - - The return value is less than bucket_count() - - - - - - - size_type - - local_iterator - - - - size_type - - const_local_iterator - - - n shall be in the range - [0, bucket_count()). - - - - A local iterator pointing the first element in the bucket with index n. - - - - - - - size_type - - local_iterator - - - - size_type - - const_local_iterator - - - n shall be in the range - [0, bucket_count()). - - - - A local iterator pointing the 'one past the end' element in the bucket with index n. - - - - - - - float - - The average number of elements per bucket. - - - - - float - - Returns the current maximum load factor. - - - - - - float - - float - - Changes the container's maximum load factor, using z as a hint. - - - - - - size_type - - void - - Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor. - - Invalidates iterators, and changes the order of elements - - - - The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function. - - - - - - - - - unordered_multimap<Key, T, Hash, Pred, Alloc>& - - - unordered_multimap<Key, T, Hash, Pred, Alloc>& - - void - - x.swap(y) - - - - Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred. - - - - -
-
diff --git a/doc/src/boost.xml b/doc/src/boost.xml new file mode 100644 index 00000000..457d5047 --- /dev/null +++ b/doc/src/boost.xml @@ -0,0 +1,9 @@ + + + + The Boost C++ Unordered Containers Library Documentation + + + + diff --git a/doc/src_code/insensitive.cpp b/doc/src_code/insensitive.cpp deleted file mode 100644 index a9e4b7b0..00000000 --- a/doc/src_code/insensitive.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -// 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) - -#include -#include -#include - -//[case_insensitive_functions - struct iequal_to - : std::binary_function - { - bool operator()(std::string const& x, - std::string const& y) const - { - return boost::algorithm::iequals(x, y); - } - }; - - struct ihash - : std::unary_function - { - bool operator()(std::string const& x) const - { - std::size_t seed = 0; - - for(std::string::const_iterator it = x.begin(); - it != x.end(); ++it) - { - boost::hash_combine(seed, std::toupper(*it)); - } - - return seed; - } - }; - - struct word_info; -//] - - struct word_info { - int tag; - explicit word_info(int t = 0) : tag(t) {} - }; - -int main() { -//[case_insensitive_dictionary - boost::unordered_map - idictionary; -//] - - BOOST_TEST(idictionary.empty()); - - idictionary["one"] = word_info(1); - BOOST_TEST(idictionary.size() == 1); - BOOST_TEST(idictionary.find("ONE") != idictionary.end() && - idictionary.find("ONE") == idictionary.find("one")); - - idictionary.insert(std::make_pair("ONE", word_info(2))); - BOOST_TEST(idictionary.size() == 1); - BOOST_TEST(idictionary.find("ONE") != idictionary.end() && - idictionary.find("ONE")->first == "one" && - idictionary.find("ONE")->second.tag == 1); - - idictionary["One"] = word_info(3); - BOOST_TEST(idictionary.size() == 1); - BOOST_TEST(idictionary.find("ONE") != idictionary.end() && - idictionary.find("ONE")->first == "one" && - idictionary.find("ONE")->second.tag == 3); - - idictionary["two"] = word_info(4); - BOOST_TEST(idictionary.size() == 2); - BOOST_TEST(idictionary.find("two") != idictionary.end() && - idictionary.find("TWO")->first == "two" && - idictionary.find("Two")->second.tag == 4); - - return boost::report_errors(); -} diff --git a/doc/unordered.qbk b/doc/unordered.qbk deleted file mode 100644 index f2a5b22d..00000000 --- a/doc/unordered.qbk +++ /dev/null @@ -1,30 +0,0 @@ -[/ 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 2007 Daniel James] - [purpose std::tr1 compliant hash containers] - [id unordered] - [dirname unordered] - [license - 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 Warning] -This documentation is a work in progress, and is often incomplete, incoherent -and, worst of all, incorrect. Don't take anything in it seriously. -[endsect] - -[include:unordered intro.qbk] -[include:unordered buckets.qbk] -[include:unordered hash_equality.qbk] -[include:unordered comparison.qbk] -[include:unordered rationale.qbk] - -[xinclude ref.xml] diff --git a/index.html b/index.html new file mode 100644 index 00000000..ad4049d4 --- /dev/null +++ b/index.html @@ -0,0 +1,9 @@ + + + + + +Automatic redirection failed, please go to +doc/html/index.html + + diff --git a/project-root.jam b/project-root.jam new file mode 100644 index 00000000..2fe494f5 --- /dev/null +++ b/project-root.jam @@ -0,0 +1,58 @@ +# +# Copyright (c) 2006 João Abecasis +# +# 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) +# + +## +## IMPORTANT NOTE: This file MUST NOT be copied over a boost installation +## + +path-constant top : . ; + +import modules ; +import path ; + +local boost-root = [ modules.peek : BOOST_ROOT ] ; +local math-header-include = $(top)/../.. ; + +if ! $(boost-root) +{ + local boost-search-dirs = [ modules.peek : BOOST_BUILD_PATH ] ; + + for local dir in $(boost-search-dirs) + { + if [ path.glob $(dir)/../../../ : boost/version.hpp ] + { + boost-root += $(dir)/../../../ ; + } + } + + if $(boost-root) + { + boost-root = [ path.make $(boost-root[1]) ] ; + } + else + { + ECHO "Warning: couldn't find BOOST_ROOT in" $(boost-root) ; + } +} + +use-project /boost/unit_test : $(boost-root)/libs/test/build ; + +project unordered + : requirements + $(boost-root) + : # build everything in ./bin.v2 + build-dir bin.v2 + ; + + + + + + + +