On 04/26/2012 06:53 PM, Sven Barth wrote:
This has nothing to do with < and > in the declaration.
TFPGMap uses < and > comparisons for key comparisons, so these operators need
to be overloaded. You can't use global operators here, because of scope problems, so
you need to use either a different type or wrap them in a record with operators.
Regards,
Sven
I have another question now. Why doesn't the developers of fgl overload `>' `<'
operator for class-type in fgl unit?
ie, put
operator >(a, b: tObject) r: boolean;
operator <(a, b: tObject) r: boolean;
into the interface section
and put
operator >(a, b: tObject) r: boolean;
begin
r:= ptrUInt(a) > ptrUInt(b);
end;
operator <(a, b: tObject) r: boolean;
begin
r:= ptrUInt(a) < ptrUInt(b);
end;
into the implementation section.
This seems a easy way to resolve the scope problem.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal