<div dir="ltr"><div class="gmail_default" style="font-family:'courier new',monospace">Hi All,</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">
While I try to compile this code:</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style><div class="gmail_default" style><font face="courier new, monospace">program demo;</font></div>
<div class="gmail_default" style><font face="courier new, monospace">{$mode objfpc}{$H+}</font></div><div class="gmail_default" style><font face="courier new, monospace">uses tree;</font></div><div class="gmail_default" style>
<font face="courier new, monospace">type</font></div><div class="gmail_default" style><font face="courier new, monospace"> TIntTree = class(specialize TTree<Integer>)</font></div><div class="gmail_default" style><font face="courier new, monospace"> end;</font></div>
<div class="gmail_default" style><font face="courier new, monospace"> TITTree = class(specialize TTree<TIntTree>)</font></div><div class="gmail_default" style><font face="courier new, monospace"> end;</font></div>
<div class="gmail_default" style><font face="courier new, monospace"><br></font></div><div class="gmail_default" style><font face="courier new, monospace">operator <(it1, it2: TIntTree): Boolean;</font></div><div class="gmail_default" style>
<font face="courier new, monospace">begin</font></div><div class="gmail_default" style><font face="courier new, monospace"> Result := it1.Data < it2.Data;</font></div><div class="gmail_default" style><font face="courier new, monospace">end;</font></div>
<div class="gmail_default" style><font face="courier new, monospace"><br></font></div><div class="gmail_default" style><font face="courier new, monospace">var</font></div><div class="gmail_default" style><font face="courier new, monospace"> itt: TITTree;</font></div>
<div class="gmail_default" style><font face="courier new, monospace">begin</font></div><div class="gmail_default" style><font face="courier new, monospace">end.</font></div><div class="gmail_default" style><br></div><div class="gmail_default" style>
<font face="courier new, monospace">I got the following error:</font></div><div class="gmail_default" style><font face="courier new, monospace"><br></font></div><div class="gmail_default" style><font face="courier new, monospace"><div class="gmail_default">
tree.pas(324,11) Error: Operator is not overloaded: "TIntTree" < "TIntTree"</div><div class="gmail_default"><br></div><div class="gmail_default">The complete code for tree.pas is here:</div><div class="gmail_default">
<br></div><div class="gmail_default"><a href="https://github.com/xrfang/fpcollection/blob/master/src/units/tree.pas">https://github.com/xrfang/fpcollection/blob/master/src/units/tree.pas</a><br></div><div class="gmail_default">
<br></div><div class="gmail_default"><br></div><div class="gmail_default">Even I defined the needed operator like above, it still refuse to compile.</div><div class="gmail_default"><br></div><div class="gmail_default">How to solve this?</div>
<div class="gmail_default"><br></div><div class="gmail_default">Thanks in advance!</div><div class="gmail_default"><br></div><div class="gmail_default">Xiangrong</div><div class="gmail_default"><br></div><div class="gmail_default">
<br></div></font></div></div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div></div>