]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/7057 (Operator== on hashtables doesn't appear to work correctly ...
authorBenjamin Kosnik <bkoz@gcc.gnu.org>
Thu, 4 Jul 2002 00:48:50 +0000 (00:48 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Thu, 4 Jul 2002 00:48:50 +0000 (00:48 +0000)
2002-07-03  Steev Wilcox  <steev@paradigmds.com>

PR libstdc++/7057
* include/ext/stl_hashtable.h: Fix.
* testsuite/ext/hash_map.cc: New.

From-SVN: r55232

libstdc++-v3/ChangeLog
libstdc++-v3/include/ext/stl_hashtable.h

index fa61f6e5fdc46cb8ce88b6995833a568aa3efcd9..786797830cd1f903bbc3b47f89991594dbaa08a5 100644 (file)
@@ -1,3 +1,14 @@
+2002-07-03  Steev Wilcox  <steev@paradigmds.com>
+        
+       PR libstdc++/7057
+       * include/ext/stl_hashtable.h: Fix.
+       * testsuite/ext/hash_map.cc: New.
+
+2002-07-03  Benjamin Kosnik  <bkoz@redhat.com>
+
+        PR libstdc++/7097
+        * include/c/std_cwchar.h: Fix.
+
 2002-07-03  Jack Reeves  <jackw_reeves@hotmail.com>
             Kenny Simpson  <theonetruekenny@yahoo.com>
             Phil Edwards  <pme@gcc.gnu.org>
index 5ee49d815f7cc32724559091318d3219659fb1f6..2bc8a2fcec0a6a1b0335b4968779ec9d5e5ed663 100644 (file)
@@ -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;
 }