tmap.cc: Use less<int>.
* tmap.cc: Use less<int>. * tlist.cc (main): Use remove_if. From-SVN: r21244
This commit is contained in:
parent
2768c658b0
commit
32dd8ef8f3
3 changed files with 10 additions and 23 deletions
|
@ -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.
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Add table
Reference in a new issue