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

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to