home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_03_06
/
3n06057a
< prev
next >
Wrap
Text File
|
1992-02-03
|
444b
|
23 lines
Listing 4
/*
* arraycmp.h - a general-purpose array comparer in C++
* using compile-time genericity
*/
#define arraycmp_declare(T) \
int arraycmp(const T a1[], const T a2[], size_t n)
#define arraycmp_implement(T) \
arraycmp_declare(T) \
{ \
size_t i; \
int cmp; \
\
for (i = 0; i < n; ++i) \
if ((cmp = T ## cf(a1[i], a2[i])) != 0) \
return cmp; \
return 0; \
}