diff options
author | Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr> | 2000-11-17 23:59:03 +0100 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2000-11-17 22:59:03 +0000 |
commit | c55d267039b1dfe9f5d29e02066a00cfea40305c (patch) | |
tree | 74716b85b3c8eb3ebc1e1fd1e60ec543afb8344e | |
parent | c9b6c28211cdf126b8e05c57a1ac9da148108a73 (diff) | |
download | gcc-c55d267039b1dfe9f5d29e02066a00cfea40305c.zip gcc-c55d267039b1dfe9f5d29e02066a00cfea40305c.tar.gz gcc-c55d267039b1dfe9f5d29e02066a00cfea40305c.tar.bz2 |
stl_tree.h: Overload operators == and != to be able to handle the case...
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
-rw-r--r-- | libstdc++-v3/ChangeLog | 3 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/map_operators.cc | 28 |
2 files changed, 29 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index af4c697..1324f10 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -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 diff --git a/libstdc++-v3/testsuite/23_containers/map_operators.cc b/libstdc++-v3/testsuite/23_containers/map_operators.cc index 4a46d81..21b62ed 100644 --- a/libstdc++-v3/testsuite/23_containers/map_operators.cc +++ b/libstdc++-v3/testsuite/23_containers/map_operators.cc @@ -22,11 +22,12 @@ #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; +} |