[fpc-pascal] Is there a way to create a generic pointer to a generic record
Le Duc Hieu
alaviss0 at gmail.com
Mon Nov 21 02:05:23 CET 2016
Is there any entry on Mantis for me to keep track of this bug status?
Thanks.
On Sun, Nov 20, 2016 at 6:03 PM, Sven Barth <pascaldragon at googlemail.com>
wrote:
> Am 20.11.2016 08:31 schrieb "Le Duc Hieu" <alaviss0 at gmail.com>:
> >
> > Here is the complete snippet that i wanted to create
> >
> >
> > Type
> > generic PGList<T> = ^specialize TGList<T>;
> >
> > generic TGList<T> = record
> > data: T;
> > next: specialize PGList<T>
> > end;
>
> You'll need to use nested types (they require modeswitch advancedrecords),
> like this:
>
> === code begin ===
>
> type
> generic TGList<T> = record
> public type
> TSelf = specialize TGList<T>;
> PGList = ^TSelf;
> public
> data: T;
> next: PGList;
> end;
>
> === code end ===
>
> Note: the TSelf construct is currently needed due to a bug in the compiler.
>
> Regards,
> Sven
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20161121/c918fe10/attachment.html>
More information about the fpc-pascal
mailing list