diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-07-17 01:30:01 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-07-16 21:30:01 -0400 |
commit | 32dd8ef8f3977be703b970066bcabe934baec32d (patch) | |
tree | 55d1b18f547be1b767de8bcd2bb67645952181b7 /libstdc++ | |
parent | 2768c658b0c2fc368da293fa616a767b92919c6c (diff) | |
download | gcc-32dd8ef8f3977be703b970066bcabe934baec32d.zip gcc-32dd8ef8f3977be703b970066bcabe934baec32d.tar.gz gcc-32dd8ef8f3977be703b970066bcabe934baec32d.tar.bz2 |
tmap.cc: Use less<int>.
* tmap.cc: Use less<int>.
* tlist.cc (main): Use remove_if.
From-SVN: r21244
Diffstat (limited to 'libstdc++')
-rw-r--r-- | libstdc++/tests/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++/tests/tlist.cc | 17 | ||||
-rw-r--r-- | libstdc++/tests/tmap.cc | 11 |
3 files changed, 10 insertions, 23 deletions
diff --git a/libstdc++/tests/ChangeLog b/libstdc++/tests/ChangeLog index 992bef5..87ce0fc 100644 --- a/libstdc++/tests/ChangeLog +++ b/libstdc++/tests/ChangeLog @@ -1,3 +1,8 @@ +1998-07-17 Jason Merrill <jason@yorick.cygnus.com> + + * tmap.cc: Use less<int>. + * tlist.cc (main): Use remove_if. + 1998-07-13 Manfred Hollstein <manfred@s-direktnet.de> * Makefile.in (VERSION): Bump to 2.9.0. diff --git a/libstdc++/tests/tlist.cc b/libstdc++/tests/tlist.cc index aaf5671..a37c999 100644 --- a/libstdc++/tests/tlist.cc +++ b/libstdc++/tests/tlist.cc @@ -1,6 +1,4 @@ -/* - test/demo of generic lists -*/ +// test/demo of generic lists #include <assert.h> @@ -8,8 +6,8 @@ else _assert(#ex, __FILE__,__LINE__); } #include <iostream.h> -#include "list.h" -#include "algo.h" +#include <list.h> +#include <algo.h> bool int_compare(int a, int b) { @@ -123,16 +121,7 @@ main() for (it = a.begin(), bit = b.begin(); it != a.end () && bit != b.end (); ) g.insert (g.end (), *it++ + *bit++); cout << "\nlist<int> g = combine(plus, a, b);\n"; print(g); -#if 1 - for (it = g.begin(); it != g.end(); ) - { - bit = it++; - if (is_odd (*bit)) - g.erase (bit); - } -#else g.remove_if (is_odd); -#endif cout << "\ng.del(is_odd);\n"; print(g); ff.erase (ff.begin (), ff.end()); diff --git a/libstdc++/tests/tmap.cc b/libstdc++/tests/tmap.cc index 7169f9d..900e66f 100644 --- a/libstdc++/tests/tmap.cc +++ b/libstdc++/tests/tmap.cc @@ -3,21 +3,14 @@ #include <iostream.h> #include <function.h> -int SIZE; - -#if 0 -/* Crashes compiler */ #define int_less less<int> -#else -struct int_less { - bool operator() (int x, int y) const { return x < y; } -}; struct str_less { bool operator() (char* x, char* y) const { return strcmp(x,y) < 0; } }; -#endif #if 0 +int SIZE; + void add(int x[], int y[], map<int,int, int_less>& a) { for (int i = 0; i < SIZE; ++i) a[x[i]] = y[i]; |