From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Stump To: egcs@cygnus.com Subject: PATCH for namespace/template support Date: Sat, 09 May 1998 03:34:00 -0000 Message-id: <199805090945.CAA17945@kithrup.com> X-SW-Source: 1998-05/msg00314.html Here is a simple one. Martin, let us know if it is wrong/incomplete. Sat May 9 02:31:07 1998 Mike Stump * tree.c (mapcar): Add OVERLOAD support. Doing diffs in .: *** ./cp/tree.c.~1~ Fri May 8 22:53:32 1998 --- ./cp/tree.c Sat May 9 02:30:55 1998 *************** mapcar (t, func) *** 1590,1595 **** --- 1590,1604 ---- return t; } + case OVERLOAD: + { + tree chain = OVL_CHAIN (t); + t = copy_node (t); + OVL_FUNCTION (t) = mapcar (OVL_FUNCTION (t), func); + OVL_CHAIN (t) = mapcar (chain, func); + return t; + } + case TREE_VEC: { int len = TREE_VEC_LENGTH (t); *** ./testsuite/g++.old-deja/g++.mike/ns15.C.~1~ Sat May 9 02:39:39 1998 --- ./testsuite/g++.old-deja/g++.mike/ns15.C Sat May 9 02:39:25 1998 *************** *** 0 **** --- 1,31 ---- + // Build don't link: + + #include + #include + + #define MAX 256 + #define MAXSTATE 1000000 + + struct R { + int count; + int state1; + int state2; + }; + + int cmp_d(const R* a, const R* b) { + return a->count > b->count; + } + + namespace CXX { + template + inline void qsort (T b[i1][i2], int (*cmp)(const T*, const T*)) { + ::qsort ((void*)b, i1*i2, sizeof(T), (int (*)(const void *, const void *))cmp); + } + } + + using namespace CXX; + + void sort_machine() { + struct R d[MAX][MAX]; + qsort (d, cmp_d); + } --------------