home *** CD-ROM | disk | FTP | other *** search
- #include <LEDA/dictionary.h>
- #include <LEDA/list.h>
-
- int cmp(int x, int y) { return y-x; }
-
- declare(INT,cmp)
-
- declare2(dictionary,INT(cmp),int)
-
- declare(list,INT(cmp))
-
- main()
- {
- dictionary(INT(cmp),int) D;
- list(INT(cmp)) L;
- dic_item it;
-
- L.read("L = ");
- L.print();
- newline;
-
- INT(cmp) x;
-
- forall(x,L)
- { cout << x << " ";
- D.insert(x,x);
- }
- newline;
-
- L.clear();
-
- forall_items(it,D) L.append(D.key(it));
-
- newline;
-
- L.print();
-
- }
-