Hi There,<br><br>I encountered a problem writing enumerator for my generic tree. The enumerator class looks like this:<br><br> TTreapEnumerator = class<br> FStack: TStack;<br> FCurrent: TTreap.PNode;<br> public<br>
constructor Create(ANode: TTreap.PNode);<br> destructor Destroy; override;<br> function MoveNext: Boolean;<br> property Current: TTreap.PNode read FCurrent;<br> end; <br><br>And the error message I got is:<br>
<br>/home/xrfang/git/fpcollection/src/units/treap.pas(363,45) Error: Incompatible type for arg no. 1: Got "THistogram.TTreap$Char$LongInt.PNode", expected "TTreap.PNode"<br><br>i.e. the enumerator expected a generic PNode, but the given node is a specialized one. How to write enumerators for generic classes?<br>
<br>Thanks!<br>