Reputation: 517
I have another question about TList
in Delphi...
I'm getting an EArgumentOutOfRangeException when accessing a TList, just the same way I've done before, after printing a different TList to console.
copy&pasted the original code below - did not change a single line
Writeln('c: '+inttostr(closed.Capacity)+' |l. 281');
for i := 0 to open.Capacity-1 do
begin
Writeln('open: ' + open[i].startpunkt + open[i].endpunkt +
IntToStr(open[i].kantenbewertung));
end;
Writeln('c: '+inttostr(closed.Capacity));
Writeln('closed.capacity: '+inttostr(closed.Capacity));
for i := 0 to closed.Capacity-1 do begin
Writeln('closed: ' + closed[i].startpunkt + closed[i].endpunkt +
IntToStr(closed[i].kantenbewertung));
end;
The Writeln('c: '+inttostr(closed.Capacity)+' |l. 281');
is clearly printed to console, the for i := 0 to open.Capacity-1 do begin
-loop as well.
Console output is: c: 2 |l. 281 open: AC3 open: BC4 open: CD6 - and then there is the error msg
Is supposed to be part of a implementation of Dijkstra's alg. if this helps.
Does anyone spot a mistake I haven't? Or is this some weird special case?
Upvotes: 0
Views: 851
Reputation: 37221
Capacity
is not the same (and may be greater) than the actual Count
.
Upvotes: 3