Does copy on write semantics applies for dynamic arrays of records?
How to properly duplicate an array of record?
Is this enough?:
type
recordA = Record
Y:integer;
end;
var x: array of recordA;
b: array of recordA;
item: recordA;
begin
SetLength(x, 2);
item.Y:= 2;
x[0] := item;
item.Y:= 5;
x[1] := item;
//Copying
b:= x;
After the copy is complete, I'll need to reset the first array:
SetLength(x, 0);
May I do it this way?