diff options
Diffstat (limited to 'contrib/libstdc++/include/ext/stl_hashtable.h')
-rw-r--r-- | contrib/libstdc++/include/ext/stl_hashtable.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/contrib/libstdc++/include/ext/stl_hashtable.h b/contrib/libstdc++/include/ext/stl_hashtable.h index 5ee49d8..2bc8a2f 100644 --- a/contrib/libstdc++/include/ext/stl_hashtable.h +++ b/contrib/libstdc++/include/ext/stl_hashtable.h @@ -610,11 +610,28 @@ bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n) { _Node* __cur1 = __ht1._M_buckets[__n]; _Node* __cur2 = __ht2._M_buckets[__n]; - for ( ; __cur1 && __cur2 && __cur1->_M_val == __cur2->_M_val; + // Check same length of lists + for ( ; __cur1 && __cur2; __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next) {} if (__cur1 || __cur2) return false; + // Now check one's elements are in the other + for (__cur1 = __ht1._M_buckets[__n] ; __cur1; __cur1 = __cur1->_M_next) + { + bool _found__cur1 = false; + for (_Node* __cur2 = __ht2._M_buckets[__n]; + __cur2; __cur2 = __cur2->_M_next) + { + if (__cur1->_M_val == __cur2->_M_val) + { + _found__cur1 = true; + break; + } + } + if (!_found__cur1) + return false; + } } return true; } |