Am 04.09.2013 08:18, schrieb Xiangrong Fang:
Hi There,

I try to write a procedure with generic parameters, but failed:

type
  generic TArray<T> = array of T;

procedure ProcessArray(arr: TArray<T>);
begin
end;


The compiler said "Generics without specialization cannot be used..."

But if I specialize the parameter then this procedure is useless.

Any ideas?

This is not yet supported. A proof of concept implementation exists locally on my computer however. It will then look like this:

=== code begin ===

type
  generic TArray<T> = array of T;

generic procedure ProcessArray<T>(arr: TArray<T>);
begin
end;

begin
  // usage:
  specialize ProcessArray<LongInt>(someintarray);
end.

=== code end ===

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to