Re: [fpc-pascal] question on docs

2024-10-20 Thread ppadilcdx--- via fpc-pascal
Ah, Ok thanks! > On Oct 20, 2024, at 3:32 PM, Martin Frb via fpc-pascal > wrote: > > The compare function is declared right inside the class > > { TFPGList } > > generic TFPGList = class(TFPSList) > private > type > TCompareFunc = function(const Item1, Item2: T): Integer; > >

Re: [fpc-pascal] question on docs

2024-10-20 Thread Martin Frb via fpc-pascal
The compare function is declared right inside the class   { TFPGList }   generic TFPGList = class(TFPSList)   private     type   TCompareFunc = function(const Item1, Item2: T): Integer; "T" is from the generic, so if you specialized with string, then T is string. It is a function, not a

Re: [fpc-pascal] question on docs

2024-10-20 Thread ppadilcdx--- via fpc-pascal
Just tried to compile a short program with that definition of compare: TCompareFunc, and that is the wrong type for TFPGList in my program (yes there is a better class for strings but I just wanted a quick example program to compile). FPC error message says it wants: function(const ShortString;c

Re: [fpc-pascal] question on docs

2024-10-20 Thread Peter B via fpc-pascal
On 20/10/2024 22:17, ppadilcdx--- via fpc-pascal wrote: I’m a little confused by some references in the docs. Hopefully I can explain it clearly. Looking at TFPGList in fgl. The Sort method refers to a TCompareFunc (it does not link to its definition). TFPGList says it’s methods are the same a