[fpc-pascal] Smart Pointers
Maciej Izak
hnb.code at gmail.com
Tue May 10 23:06:09 CEST 2016
2016-05-10 22:33 GMT+02:00 Anthony Walter <sysrpl at gmail.com>:
> From your example code, the usage looks exactly like what I'd want. One
> question though. Would the magic code also work with var and out arguments?
>
Yes.
> That is with (note these functions are generic):
>
> procedure Foo1<T>(A: TArray<T>);
> procedure Foo2<T>(var A: TArray<T>);
> procedure Foo3<T>(out A: TArray<T>);
>
> Where each can be called with a TManagedArray<T> as the "A" argument
> without qualifying the Instance field?
>
Yes, anyway example is buggy because we don't have "type inference" for
generic methods/functions like in Java (which is on my TODO list), but is
possible to compile and run example like this:
var
a: TManagedArray<Integer>;
begin
Foo1<Integer>(a);
Foo2<Integer>(a);
Foo3<Integer>(a);
--
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160510/14013fb6/attachment.html>
More information about the fpc-pascal
mailing list