[fpc-pascal] fgl.TFPGMap

Honza befelemepeseveze at gmail.com
Thu Jan 20 20:18:38 CET 2011


2011/1/20 Alex Shishkin <alexvins at mail.ru>:
> Following code causes error "Operator is not overloaded: "TObject" <
> "TObject""
> How to make it work?
>
> program generictest2;
> {$mode objfpc}{$H+}
> uses
>  fgl;
> operator < (a: TObject; b: TObject): boolean;
> begin
>  result := PtrInt(a) < PtrInt(b);
> end;
> type
>  TMyMap = specialize TFPGMap <TObject, TObject>;
> begin
> end.
AFAIK TFPGMap can be specialized only with types which have the
relational operators predefined by the compiler. See also:
http://bugs.freepascal.org/view.php?id=15480

You can take a look on this container lib, which might be helpful for your task:
http://code.google.com/p/fprb/wiki/heContnrs
-- 
bflm
freepascal-bits.blogspot.com



More information about the fpc-pascal mailing list