Remove find_matching_node.

FWIW the standard says that equality is undefined behaviour if the Hash
and Pred function objects behave differently. But I think we should
support different hash functions, e.g. so that randomized hash functions
will work.
This commit is contained in:
Daniel James
2016-10-22 10:04:36 +01:00
parent 9772c01161
commit c680fa7418
3 changed files with 5 additions and 16 deletions

View File

@ -259,10 +259,10 @@ namespace boost { namespace unordered { namespace detail {
for(iterator n1(this->begin()); n1.node_;) for(iterator n1(this->begin()); n1.node_;)
{ {
iterator n2(other.find_matching_node(n1)); node_pointer n2 = other.find_node(other.get_key(n1->value()));
if (!n2.node_) return false; if (!n2) return false;
iterator end1(next_group(n1.node_)); node_pointer end1 = next_group(n1);
iterator end2(next_group(n2.node_)); node_pointer end2 = next_group(n2);
if (!group_equals(n1, end1, n2, end2)) return false; if (!group_equals(n1, end1, n2, end2)) return false;
n1 = end1; n1 = end1;
} }

View File

@ -728,17 +728,6 @@ namespace boost { namespace unordered { namespace detail {
find_node_impl(hash(k), k, this->key_eq()); find_node_impl(hash(k), k, this->key_eq());
} }
node_pointer find_matching_node(iterator n) const
{
// TODO: Does this apply to C++11?
//
// For some stupid reason, I decided to support equality comparison
// when different hash functions are used. So I can't use the hash
// value from the node here.
return find_node(get_key(*n));
}
// Reserve and rehash // Reserve and rehash
void reserve_for_insert(std::size_t); void reserve_for_insert(std::size_t);

View File

@ -254,7 +254,7 @@ namespace boost { namespace unordered { namespace detail {
for(iterator n1(this->begin()); n1.node_; ++n1) for(iterator n1(this->begin()); n1.node_; ++n1)
{ {
node_pointer n2 = other.find_matching_node(n1); node_pointer n2 = other.find_node(other.get_key(n1->value()));
if (!n2 || *n1 != n2->value()) if (!n2 || *n1 != n2->value())
return false; return false;