<p>Am 09.06.2015 11:12 schrieb "aradeonas" <<a href="mailto:aradeonas@operamail.com">aradeonas@operamail.com</a>>:<br>
><br>
> Hi,<br>
> <br>
>><br>
>> TTestObject = object<br>
>> i: integer;<br>
>> end;<br>
>> <br>
>> TTestObjectList = specialize TFPGList<TTestObject>; <br>
><br>
> <br>
> When I try to compile this code compiler said :<br>
> <br>
>><br>
>> Error: Operator is not overloaded: "TTestObject" = "TTestObject"<br>
><br>
> <br>
> I dont even know what is this mean!</p>
<p>TFPGList<> requires an = operator for the type you want to specialize with. While you could declare a global operator overload for TTestObject this won't help as it needs to be a local one. Only records with modeswitch advancedrecords support this currently, thus you should adjust your code like this:</p>
<p>=== code begin ===</p>
<p>{$modeswitch advancedrecords} // this needs to be after the $mode, but before the uses section</p>
<p>type<br>
TTestObject = record<br>
i: integer;<br>
class operator = (const aLeft, aRight: TTestObject): Boolean;<br>
end;<br>
<br>
TTestObjectList = specialize TFPGList<TTestObject>;</p>
<p>// ...</p>
<p>class operator TTestObject.=(const aLeft, aRight: TTestObject): Boolean;<br>
begin<br>
// whatever you need for equality<br>
end;</p>
<p>=== code end ===</p>
<p>Regards,<br>
Sven</p>