[fpc-pascal] Incompatible type for generics?

Xiangrong Fang xrfang at gmail.com
Tue Sep 24 17:32:31 CEST 2013


I know it is same but why no error on the line:

for n in sm1.reversed...

regards.
在 2013-9-24 下午11:23,"Sven Barth" <pascaldragon at googlemail.com>写道:

>  Am 24.09.2013 17:14, schrieb Xiangrong Fang:
>
>  2013/9/24 Sven Barth <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
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130924/c6f01532/attachment.html>


More information about the fpc-pascal mailing list