[fpc-pascal] TFPGMapObject duplicate errors

Michael Van Canneyt michael at freepascal.org
Sat Oct 3 16:11:24 CEST 2020



On Sat, 3 Oct 2020, Mattias Gaertner via fpc-pascal wrote:

> On Sat, 3 Oct 2020 15:53:58 +0200 (CEST)
> Michael Van Canneyt via fpc-pascal <fpc-pascal at lists.freepascal.org>
> wrote:
>
>> On Fri, 2 Oct 2020, Ryan Joseph via fpc-pascal wrote:
>> [...]
>> > Thanks. Sneaky that sorted had to be set to true. Not sure why that
>> > would be. 
>> 
>> Because otherwise it would take a linear search to do IndexOf
>> whenever you insert/append an element in the list.
>
> Insert element is linear anyway.

But it does not need a search, I suppose ?

>
> Why not set Duplicate to dupAccept as default?

Just guessing:
Because it is a map, and usually you don't want a map to contain duplicates ?

If any change is needed, I would set the 'Sorted' to true by default.

Michael.


More information about the fpc-pascal mailing list