> On Sep 17, 2020, at 9:59 AM, J. Gareth Moreton via fpc-devel > <fpc-devel@lists.freepascal.org> wrote: > > type generic TMyArray<T> = record > Data: ^T; > Length: PtrUInt; > end; > > The compiler will complain about T being an unresolved forward declaration. > Outside of specifying a second parameter for the pointer type (which would be > a little unfriendly for third-party users), there isn't really a way around > this. >
To be clear all the features work but it's not as optimized as dynamic arrays and could be cumbersome with arrays of records. I think you're supposed to redeclare a pointer to T: type generic TMyArray<T> = record type TP = ^T; public Data: TP; Length: PtrUInt; end; Regards, Ryan Joseph _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel