Changeset 76 for Generics/TemplateGenerics/Generic/ListImplementation.tpl
- Timestamp:
- Oct 29, 2010, 7:49:29 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/TemplateGenerics/Generic/ListImplementation.tpl
r74 r76 1 1 uses 2 2 RtlConsts; 3 4 // Used instead of System.Move form because of error: Identifier "System" not found5 procedure SystemMove(const Source; var Dest; Count: SizeInt);6 begin7 Move(Source, Dest, Count);8 end;9 3 10 4 { TGList } … … 130 124 if FCount = Capacity then Expand; 131 125 if Index < FCount then 132 System Move(FItems[Index], FItems[Index + 1], (FCount - Index) * SizeOf(TListItem));126 System.Move(FItems[Index], FItems[Index + 1], (FCount - Index) * SizeOf(TListItem)); 133 127 FItems[Index] := Item; 134 128 FCount := FCount + 1; … … 163 157 raise EListError.CreateFmt(SlistIndexError, [NewIndex]); 164 158 Temp := FItems[CurIndex]; 165 Delete(CurIndex); 166 Insert(NewIndex, Temp); 159 if NewIndex > CurIndex then begin 160 System.Move(FItems[CurIndex + 1], FItems[CurIndex], (NewIndex - CurIndex) * SizeOf(TListItem)); 161 end else 162 if NewIndex < CurIndex then begin 163 System.Move(FItems[NewIndex], FItems[NewIndex + 1], (CurIndex - NewIndex) * SizeOf(TListItem)); 164 end; 165 FItems[NewIndex] := Temp; 166 //Delete(CurIndex); 167 //Insert(NewIndex, Temp); 167 168 end; 168 169 … … 289 290 raise EListError.CreateFmt(SListIndexError, [Index]); 290 291 FCount := FCount - 1; 291 System Move(FItems[Index + 1], FItems[Index], (FCount - Index) * SizeOf(TListItem));292 System.Move(FItems[Index + 1], FItems[Index], (FCount - Index) * SizeOf(TListItem)); 292 293 // Shrink the list if appropriate 293 294 if (Capacity > 256) and (FCount < Capacity shr 2) then
Note:
See TracChangeset
for help on using the changeset viewer.