Luke,
a dynamic array is an array of pointers. There are two things
I think you can do:
1.
var MyArray: array of TSomething;
MyBuffer: array of TSomething;
setlength(MyArray, 50);
{do stuff with MyArray}
setlength(MyBuffer,49);
MyBuffer := (copy(MyArray,0,19)+copy(MyBuffer,21,49));
{as a way of deleting element # 20}
{should work}
2. You might try
MyArray[20] := Nil;
this would dereference that element - but I am not sure how the
rest of the array would behave after that, should you try to
iterate through it afterwards .... try it out ;-)
You can always simply truncate a dynamic array using the
Setlength function - all data past the truncation point simply
gets discarded and I know this to behave in a benign fashion
as it is something I have used in the past.
H.t.h. - should give you something to play with anyhow ;-) -Peter
> Simple one for ya:
> Delete(MyDynArray, MyIndex, 1);
> That doesn't work. "Incompatible types" where MyDynArray is.
>
> How do I remove an element from the middle of a dynamic array?
>
> Luke Pascoe.
> ---------------------------------------------------------------------------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"