[fpc-pascal] TSortedCollection dupes ordering

Jim Leonard trixter at oldskool.org
Tue Feb 4 21:28:12 CET 2014


On 2/4/2014 1:40 PM, waldo kitty wrote:
>
> i have a TSortedCollection that i'm allowing duplicate keys to be
> inserted in... the problem that i'm having is that the duplicate keys
> are in reverse order from how they were inserted...

Sounds like your TSortedCollection.Compare() needs additional logic.  It 
isn't doing enough comparisons internally to order things properly.

> i am overriding MyCollection^.Insert because i have additional tasks
> that need to be done at the time of insertion... without duplicate keys,

Wouldn't it be better to perform your additional tasks before the 
insertion, then call a normal .Insert?  Why overload something if there 
isn't really a need to?
-- 
Jim Leonard (trixter at oldskool.org)
Check out some trippy MindCandy: http://www.mindcandydvd.com/
A child borne of the home computer wars: http://trixter.oldskool.org/
You're all insane and trying to steal my magic bag!



More information about the fpc-pascal mailing list