[fpc-pascal] TSortedCollection dupes ordering

waldo kitty wkitty42 at windstream.net
Fri Feb 7 01:41:40 CET 2014


On 2/6/2014 1:47 PM, Jim Leonard wrote:
> On 2/6/2014 11:04 AM, waldo kitty wrote:
>> ahh... i see what you are doing... you are passing the pointer to the
>> whole record instead of just the needed key... hummm... i'll have to
>> think about that and how to do it in my app... right now i'm only
>> passing the necessary key because the record is 'large'... but then
>> again... some thought and meditation is necessary ;)
>
> Not much thought required -- a pointer to the record is 4 bytes, no matter how
> large the record is.

yep! i realized this when i was going back thru the code cleaning it up and 
letting the other side of my brain wander about in its own world ;)

> In fact, it's probably faster than what you're doing, and more flexible.

i was sending the pointer to field's contents ;)

[time passes]

well, i thought i was... my KeyOf routine does a cast using

   PTLERec(Item)^.catnbr

but my (TLE) compare is apparently only sending the pointer to the catnbr string 
because the cast there is simply

   PString(Key1)^
and
   PString(Key2)^

the only place i understand that my (TTLEColl) compare is in play is in

   If NOT Search(KeyOf(Item), I) OR Duplicates Then  // Item valid

from the TTLEColl.Insert routine override that i posted previously... that 
Insert routine is taking a pointer to an entire record...

so now i'm a bit confused but it has been a long day... again... :/

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