TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Roger Scudder
from: Pascal Schmidt
date: 2004-06-07 16:43:36
subject: Re: [C] C Puzzles

Hi Roger! :-)

 RS> Oh yeah, I was playing with the dupes question too.  I think it would 
 RS> make a good candidate for a template with specialization for strings, 
 RS> UDTs, etc... but then C doesn't support templates, does it?
You could do something similar to qsort(3):

void qsort(void *base, size_t nmemb, size_t size,
           int(*compar)(const void *, const void *));

The profile would be something like (returning the number of elements in
the new array, assuming in-place editing of the array):

size_t nub(void *base, size_t nmemb, size_t size,
           int(*compar)(const void *, const void *));


Ciao
Pascal

--- Msged/LNX 6.1.1
* Origin: By order of the king, the city must empty. (1:153/401.2)
SEEN-BY: 633/267 270
@PATH: 153/401 307 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.