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

ZHANG Dao-yuan 1123monkey at gmail.com
Thu Apr 26 10:45:18 CEST 2012


> program moi;
> {$mode objfpc}
>     uses fgl;
>     type
>         tSI= specialize tFpGMap<integer, tObject>;
>         // tIS= specialize tFpGMap<tObject, integer>;
> begin
> end.

Hi,
I'm trying to use template in fpc 2.6.0. I can map class type as value as above code can be compiled. But if I uncomment the declaration of tIS -- map class type as key, fpc fail to compile and print out these error msgs:

Error: Operator is not overloaded: "TObject" < "TObject"
Error: Operator is not overloaded: "TObject" > "TObject"
t.pas(10) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not specify a source file to be compiled)

Any way to resolve it?



More information about the fpc-pascal mailing list