Commit 32dd8ef8 by Jason Merrill Committed by Jason Merrill

tmap.cc: Use less<int>.

	* tmap.cc: Use less<int>.
	* tlist.cc (main): Use remove_if.

From-SVN: r21244
parent 2768c658
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.
......
/*
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());
......
......@@ -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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment