Re: Elementary but surprisingly difficult.
- From: Bernd Paysan <bernd.paysan@xxxxxx>
- Date: Sun, 25 May 2008 20:59:24 +0200
Albert van der Horst wrote:
The main problem is that the content cannot be placed
on the stack they cannot be compared with <> etc.
I don't see the big problem. If you can't place the content on the stack,
place a pointer. And compare with whatever compare function you need. If
you want this a library function like qsort, define that your array is an
array of pointers to the actual structures, and that you have a deferred
word for the actual comparison. This will compare for <= (whatever that is
for your objects), and is used for both the qsort and the duplicate
removal. You just have to make sure that the comparison order is the right
one, i.e. if you expect a to be <= b, compare b <= a for duplicate removal
(will only be true if b=a).
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/
.
- Follow-Ups:
- Re: Elementary but surprisingly difficult.
- From: Anton Ertl
- Re: Elementary but surprisingly difficult.
- References:
- Elementary but surprisingly difficult.
- From: Albert van der Horst
- Re: Elementary but surprisingly difficult.
- From: Slava Pestov
- Re: Elementary but surprisingly difficult.
- From: Bernd Paysan
- Re: Elementary but surprisingly difficult.
- From: Albert van der Horst
- Elementary but surprisingly difficult.
- Prev by Date: Re: Elementary but surprisingly difficult.
- Next by Date: Re: Elementary but surprisingly difficult.
- Previous by thread: Re: Elementary but surprisingly difficult.
- Next by thread: Re: Elementary but surprisingly difficult.
- Index(es):
Relevant Pages
|