Re: [fpc-pascal] TFPGMapObject duplicate errors

2020-10-03 Thread Michael Van Canneyt via fpc-pascal
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 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. Beca

Re: [fpc-pascal] TFPGMapObject duplicate errors

2020-10-03 Thread Mattias Gaertner via fpc-pascal
On Sat, 3 Oct 2020 15:53:58 +0200 (CEST) Michael Van Canneyt via fpc-pascal 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 Inde

Re: [fpc-pascal] TFPGMapObject duplicate errors

2020-10-03 Thread Michael Van Canneyt via fpc-pascal
On Fri, 2 Oct 2020, Ryan Joseph via fpc-pascal wrote: On Oct 1, 2020, at 7:00 PM, Vojtěch Čihák via fpc-pascal wrote: I looked to code, it gives error only when map is Sorted=True. Thanks. Sneaky that sorted had to be set to true. Not sure why that would be. Because otherwise it wou

Re: [fpc-pascal] TFPGMapObject duplicate errors

2020-10-02 Thread Ryan Joseph via fpc-pascal
> On Oct 1, 2020, at 7:00 PM, Vojtěch Čihák via fpc-pascal > wrote: > > I looked to code, it gives error only when map is Sorted=True. > Thanks. Sneaky that sorted had to be set to true. Not sure why that would be. Regards, Ryan Joseph __

Re: [fpc-pascal] TFPGMapObject duplicate errors

2020-10-01 Thread Vojtěch Čihák via fpc-pascal
    Result := Count;   CopyKey(AKey, inherited Insert(Result)); end;     V. __ Od: "Ryan Joseph via fpc-pascal" Komu: "FPC-Pascal users discussions" Datum: 02.10.2020 02:24 Předmět: [fpc-pascal] TFPGMapObject duplicate errors

[fpc-pascal] TFPGMapObject duplicate errors

2020-10-01 Thread Ryan Joseph via fpc-pascal
I expected to get an assertion when I added the duplicate key "foo". What am I doing wrong? type TSomeMap = specialize TFPGMapObject; var map: TSomeMap; begin map := TSomeMap.Create(true); map.Duplicates := dupError; map.Add('foo', TObject.Create); map.Add('foo', TObject.Create); Reg