RTL: Implementation of TList<T>.List property
In TList<T>
there is no direct access to array items, which will give a big overhead when working with the list in the case of T = record.
When accessing through TList<T>.Items[I]
there will be a full copying of the record, and also there is no possibility to modify the items, except for full copying of the record, changing its field and reverse assignment.
var
A: TList<TRect>;
R: TRect;
...
// modify list
for I := 0 to A.Count - 1 do
begin
R := A[I];
R.Left := 123;
A[I] := R;
end;
In Delphi this is solved by an additional property TList<T>.List
giving direct access to the elements and reading/modifying is done as when working with a regular array of records.
// modify list
for I := 0 to A.Count - 1 do
A.List[I].Left := 123;
I would suggest the following patch: fpc_40642.patch
Edited by Alexander (Rouse_) Bagel