[fpc-pascal] Re: Can it map class type as key?
JC Chu
jcchu at acm.org
Thu Apr 26 11:26:07 CEST 2012
Notice the {$MODE DELPHI} directive.
On Thu, Apr 26, 2012 at 17:24, Lukasz Sokol <el.es.cr at gmail.com> wrote:
> 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.
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
--
Best Regards,
JC Chu
More information about the fpc-pascal
mailing list