Now the operator[] of typed pointer returns the dereferenced pointer to type(ref to value).
Thanks to DiamondShark.
A sample
program myprogram;
procedure pf < T> (cnt:integer);
p:pointer;
ptype:^T;
valueA:T;
i:integer;
begin
GetMem(p,cnt*sizeof(T));
ptype:=p;
for i:=0 to cnt-1 do ptype[i]:=valueA;
FreeMem(p);
end;
begin
pf < boolean> (100);
pf < integer> (200);
pf < double> (300);
end
Комментариев нет:
Отправить комментарий