If the containers have equality comparisons, they'll also need 'hash_value'. Untested and undocumented, as before.

[SVN r42108]
This commit is contained in:
Daniel James
2007-12-16 18:20:25 +00:00
parent c918da0249
commit 3002a898a0
6 changed files with 146 additions and 2 deletions
@@ -1926,6 +1926,41 @@ public:
return true;
}
inline bool group_hash(local_iterator_base it, type_wrapper<key_type>*) const
{
std::size_t seed = group_count(it);
boost::hash_combine(seed, hash_function()(*it));
return seed;
}
inline bool group_hash(local_iterator_base it, void*) const
{
std::size_t seed = hash_function()(it->first);
local_iterator_base end = it;
end.next_group();
do {
boost::hash_combine(seed, it->second);
} while(it != end);
return seed;
}
std::size_t hash_value() const
{
std::size_t seed = 0;
for(bucket_ptr i = this->cached_begin_bucket_,
j = this->buckets_ + this->bucket_count_; i != j; ++i)
{
for(local_iterator_base it(i->next_); it.not_finished(); it.next_group())
seed ^= group_hash(it, (type_wrapper<value_type>*)0);
}
return seed;
}
private:
// strong exception safety, no side effects