forked from boostorg/unordered
Some more work on the unordered containers documentation.
[SVN r2889]
This commit is contained in:
23
doc/hash_equality.qbk
Normal file
23
doc/hash_equality.qbk
Normal file
@@ -0,0 +1,23 @@
|
||||
[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 Value,
|
||||
typename Hash = ``[classref boost::hash]``<Value>,
|
||||
typename Pred = std::equal_to<Value>,
|
||||
typename Alloc = std::allocator<Value> >
|
||||
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
|
||||
|
||||
[endsect]
|
||||
Reference in New Issue
Block a user