On 17.09.2013 14:52, Dennis Poon wrote:
I have this:
uses fgl;

Type
   RScene=record
     ID : Word;
     Name, Category : String;
   end;

   TSceneList=specialize TFPGList<RScene>;


The error is:  Operator is not overloaded: "RScene" = "RScene"


I suppose the generic thing does not know how to compare 2 records.
How do I solve that?

Provide a "=" operator overload for the record:

=== code begin ===

uses fgl;

{$modeswitch advanced_records}

Type
   RScene=record
     ID : Word;
     Name, Category : String;
     class operator = (aLeft, aRight: RScene): Boolean;
   end;

   TSceneList=specialize TFPGList<RScene>;

class operator RScene.=(aLeft, aRight: RScene): Boolean;
begin
  ...
end;

=== code end ===

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to