[fpc-pascal] Incompatible type for generics?

Sven Barth pascaldragon at googlemail.com
Tue Sep 24 17:21:30 CEST 2013


Am 24.09.2013 17:14, schrieb Xiangrong Fang:
> 2013/9/24 Sven Barth <pascaldragon at googlemail.com 
> <mailto:pascaldragon at googlemail.com>>
>
>     How is PNode declared? What is the exact error?
>
>
> PNode is declared inside TTreap generic class, the source is here:
>
> https://github.com/xrfang/fpcollection/blob/master/src/units/treap.pas
>
> The exact error is:
>
> Error: Incompatible types: got 
> "TStringMapper.TTreap$AnsiString$AnsiString" expected "TStringMapper"
The error is exactly the same as the one in your TIntTree, because the 
return type of TTreap<String, String>.Reversed is TTreap<String, String> 
and nothing else. Thus the solution is the same as for TIntTree.Next: 
either none or a new "Reversed" function. And again: This problem would 
also occur with non generic classes.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130924/f706d0e9/attachment.html>


More information about the fpc-pascal mailing list