[fpc-pascal] Need some advice
Luca Olivetti
luca at ventoso.org
Wed Jan 24 21:34:16 CET 2024
El 24/1/24 a les 20:31, ppadilcdx via fpc-pascal ha escrit:
> Trying to use the fgl unit, specifically the TFPGMap. Below is a
> simple program I'm trying to compile; it gives me two errors:
>
> fgl.pp(1582,18) Error: Operator is not overloaded: "pair" < "pair"
> fgl.pp(1584,23) Error: Operator is not overloaded: "pair" > "pair"
>
>
add a {$Modeswitch advancedrecords} and use class operators
> program test;
> {$mode objfpc}
{$modeswitch advancedrecords}
>
> uses
> fgl;
>
> type
> pair = record
> x, y : integer;
class operator < (a,b:pair):boolean;
class operator > (a,b:pair):boolean;
> end;
>
> operator < (a,b: pair) r:boolean;
class operator pair.<(a,b:pair):boolean;
> begin
> if a.x < a.y then
> r := true
result:=true
> else
> r := false;
result:=false;
> end;
bye
--
Luca
More information about the fpc-pascal
mailing list