[fpc-pascal] Re: Can it map class type as key?

Lukasz Sokol el.es.cr at gmail.com
Thu Apr 26 11:24:12 CEST 2012


On 26/04/2012 10:14, JC Chu wrote:
> It fails because the operators < and > are not defined for TObject, 
> which is assumed by TFPGMap<TKey, TValue>.KeyCompare().
> 
> As a makeshift you can implement a record type to wrap TObject and 
> define these operators for it.  See the attached file for an
> example.
> 
> Hope it helps.
> 

The OP asks for generics usage, not for the operator overload (notice the 'specialize' keyword).

L.




More information about the fpc-pascal mailing list