2013/3/22 Sven Barth <pascaldra...@googlemail.com>
> > The problem is gone, because PNode is not a generic class, but only a > record. However, the following errors are generated: > > 2.6.x does not support nested types in generics. Generic fixes and > improvements are only found in 2.7.1 as most of them were to invasive to be > merged back. > OK, then why this error happened: demo2.lpr(76,13) Error: Incompatible types: got "TRoller.TTreap$PPerson$Byte" expected "TRoller" The problematic lines are: === demo2.lpr === var n: TRoller.PNode; r1, r2: TRoller; begin r1 := TRoller.Create; with r1 do begin ... ... * r2 := r1.Copy(@OrderByAge);* ... ... end; end. === treap.pas === function TTreap.Copy(Comp: TComparator): TTreap; var n: PNode; begin if Comp = nil then Comp := FComparator; Result := TTreap.Create; Result.Comparator := Comp; for n in Self do Result.Insert(n^.Key, n^.Value); end; I don't see there are "nested types" and why there is a type named: TRoller.TTreap$PPerson$Byte? Shouldn't be either TRoller or TTreap$PPerson$Byte but not both? Thanks, Xiangrong
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal