2014-02-05 waldo kitty <wkitt...@windstream.net>: > On 2/4/2014 5:16 PM, Frederic Da Vitoria wrote: > >> 2014-02-04 waldo kitty <wkitt...@windstream.net <mailto: >> wkitt...@windstream.net>>: >> > [...] > > i kinda thought about that earlier when i was digging thru the >> code... IIRC, >> insert was overridden because there are cases where the existing >> record >> needs to be replaced (because the new record is newer) using AtPut >> and the >> non-added records must be logged and their reason for not being added >> (older >> or same)... >> >> >> Just a quick idea which could be completely wrong, but wouldn't it solve >> your >> issue if Compare always returned -1 instead of 0? >> > > no, because i lose (at least) the logging of why the record was tossed > out... see below...
Hm, yes, you don't always want to keep duplicates. > it wouldn't help with the duplicate keys being inserted in reverse order... > Once again I did not test this, but it seems to me that if Compare returned -1 instead of 0, any duplicate would be inserted after because it would never be considered as equal to any other. But since you still want your collection to be able to choose between skipping duplicates or keeping them, the Compare modification would have to be slightly more subtle, something like: if result = 0 and Duplicates then result := -1 at the end of the Compare function. -- Frederic Da Vitoria (davitof) Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal