[fpc-pascal] TSortedCollection dupes ordering

waldo kitty wkitty42 at windstream.net
Tue Feb 4 20:40:44 CET 2014


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...

i am overriding MyCollection^.Insert because i have additional tasks that need 
to be done at the time of insertion... without duplicate keys, everything works 
perfectly so that lesser keys do have a lower index than higher keys... with 
duplicate keys, though, the lesser keys are right but the duplicate lesser keys 
are in reverse order within their "grouping"...

MyCollection^.Insert uses AtInsert to insert the new record... i switched this 
to Insert after i read the documentation statement that AtInsert should not be 
used... when i did this, my program crashed with an unknown runtime error 202 
(stack overflow???)... at a guess, i would say that i ended up calling 
MyCollection^.Insert recursively... perhaps instead of just AtInsert i should 
use something_else.Insert inside my Insert??

anyway, how can i fix this problem where duplicates are inserted in the proper 
order while still retaining the existing proper key ordering?

-- 
NOTE: No off-list assistance is given without prior approval.
       Please keep mailing list traffic on the list unless
       private contact is specifically requested and granted.



More information about the fpc-pascal mailing list