]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stl_tree.h: Overload operators == and != to be able to handle the case...
authorTheodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
Fri, 17 Nov 2000 22:59:03 +0000 (23:59 +0100)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Fri, 17 Nov 2000 22:59:03 +0000 (22:59 +0000)
2000-11-17  Theodore Papadopoulo  <Theodore.Papadopoulo@sophia.inria.fr>

* include/bits/stl_tree.h: Overload operators == and != to be able
to handle the case (const_iterator,iterator) and
(iterator,const_iterator), thus fixing libstdc++/737 and the like.
* testsuite/23_containers/map_operators.cc (test02): New tests.

From-SVN: r37532

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/23_containers/map_operators.cc

index af4c6975f50032a3d6496c647a7f1a338c811967..1324f10dd51b582e35eeee077af3e5a1596a4bef 100644 (file)
@@ -3,7 +3,8 @@
        * include/bits/stl_tree.h: Overload operators == and != to be able
        to handle the case (const_iterator,iterator) and
        (iterator,const_iterator), thus fixing libstdc++/737 and the like.
-
+       * testsuite/23_containers/map_operators.cc (test02): New tests.
+       
 2000-11-17  Loren J. Rittle  <ljrittle@acm.org>
 
        * acinclude.m4 (GLIBCPP_ENABLE_CSTDIO): Correct last patch
index 4a46d811ff1df361dd9757d1c654df431726a731..21b62ed5e4ea44fcd5699fbd57b96f6d86bacf38 100644 (file)
 
 #include <map>
 #include <string>
+#include <iostream>
 
 // map and set
 // libstdc++/86: map & set iterator comparisons are not type-safe
 // XXX this is XFAIL for the time being, ie this should not compile
-int main(void)
+void test01()
 {
   bool test = true;
   std::map<unsigned int, int> mapByIndex;
@@ -42,3 +43,28 @@ int main(void)
 
   return 0;
 }
+
+// http://sources.redhat.com/ml/libstdc++/2000-11/msg00093.html
+void test02()
+{
+    typedef std::map<int,const int> MapInt;
+
+    MapInt m;
+
+    for (unsigned i=0;i<10;++i)
+        m.insert(MapInt::value_type(i,i));
+
+    for (MapInt::const_iterator i=m.begin();i!=m.end();++i)
+        std::cerr << i->second << ' ';
+
+    for (MapInt::const_iterator i=m.begin();m.end()!=i;++i)
+        std::cerr << i->second << ' ';
+}
+
+int main()
+{
+  test01();
+  test02();
+
+  return 0;
+}