Имя: Пароль:
IT
 
А кто юзал генерики в Delphi 2009 под Win32?
0 Ненавижу 1С
 
гуру
13.11.09
11:02
есть вопрос

вызываю

SetParam(GetFieldList);
где

function TFObject.GetFieldList: TFNamedDataList;
begin
 Result:=TFNamedDataList.Create;
 Result.Add('UID',fUID);
end;
и

procedure TFQuery.SetParam(aList: TFNamedDataList);
var
 L:TPair<string,variant>;
begin
 for L in aList do //вот здесь откуда то еще неизвестно какие элементы (всего 4 вместо 1) берутся
   SetParam(L.Key,L.Value);
end;
и

TFNamedDataList=class(TDictionary<string,variant>);
проблема на строчке с комментарием
1 Ненавижу 1С
 
гуру
13.11.09
11:45
понимаю, что пятница
2 Ненавижу 1С
 
гуру
13.11.09
11:47
function TFObject.GetFieldList: TFNamedDataList;
var
 L:TPair<string,variant>;
begin
 Result:=TFNamedDataList.Create;
 for L in Result do
   Writeln(L.Key);  //уже здесь ерунда какая то!
 Result.Add('UID',fUID);
end;
3 Жан Пердежон
 
13.11.09
11:54
скажем дружно...
4 Ненавижу 1С
 
гуру
17.11.09
12:41
баг:

[QC Short Description]
Generics.collection TDictionary iterators may return garbage data

[QC Description]
TDictionary<TKey,TValue>.TPairEnumerator.MoveNext
TDictionary<TKey,TValue>.TKeyEnumerator.MoveNext:
TDictionary<TKey,TValue>.TValueEnumerator.MoveNext:

all contain the line

while FIndex < Length(FDictionary.FItems) do

this should be

while FIndex < Length(FDictionary.FItems) -1 do

since FIndex is incremented after the check and the last item has index = length( FDictionary.FItems )-1

This can lead to the enumerators returning non-existing data
QC Entry 69427
5 Ненавижу 1С
 
гуру
17.11.09
12:58
исправил, работает