Hi There,

I encountered a problem writing enumerator for my generic tree. The
enumerator class looks like this:

  TTreapEnumerator = class
    FStack: TStack;
    FCurrent: TTreap.PNode;
  public
    constructor Create(ANode: TTreap.PNode);
    destructor Destroy; override;
    function MoveNext: Boolean;
    property Current: TTreap.PNode read FCurrent;
  end;

And the error message I got is:

/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"

i.e. the enumerator expected a generic PNode, but the given node is a
specialized one.  How to write enumerators for generic classes?

Thanks!
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to