|
@@ -25,6 +25,7 @@
|
|
type
|
|
type
|
|
generic THashmapIterator<TKey, TValue, T, TTable>=class
|
|
generic THashmapIterator<TKey, TValue, T, TTable>=class
|
|
public
|
|
public
|
|
|
|
+ type PValue=^TValue;
|
|
var
|
|
var
|
|
Fh,Fp:SizeUInt;
|
|
Fh,Fp:SizeUInt;
|
|
FData:TTable;
|
|
FData:TTable;
|
|
@@ -32,10 +33,12 @@
|
|
function GetData:T;inline;
|
|
function GetData:T;inline;
|
|
function GetKey:TKey;inline;
|
|
function GetKey:TKey;inline;
|
|
function GetValue:TValue;inline;
|
|
function GetValue:TValue;inline;
|
|
|
|
+ function GetMutable:PValue;inline;
|
|
procedure SetValue(value:TValue);inline;
|
|
procedure SetValue(value:TValue);inline;
|
|
property Data:T read GetData;
|
|
property Data:T read GetData;
|
|
property Key:TKey read GetKey;
|
|
property Key:TKey read GetKey;
|
|
property Value:TValue read GetValue write SetValue;
|
|
property Value:TValue read GetValue write SetValue;
|
|
|
|
+ property MutableValue:PValue read GetMutable;
|
|
end;
|
|
end;
|
|
|
|
|
|
generic THashmap<TKey, TValue, Thash>=class
|
|
generic THashmap<TKey, TValue, Thash>=class
|
|
@@ -164,7 +167,7 @@ begin
|
|
inc(FDataSize);
|
|
inc(FDataSize);
|
|
(FData[h]).pushback(pair);
|
|
(FData[h]).pushback(pair);
|
|
|
|
|
|
- if (FDataSize > 2*FData.size) then
|
|
|
|
|
|
+ if (FDataSize > 5*FData.size) then
|
|
EnlargeTable;
|
|
EnlargeTable;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -229,6 +232,11 @@ begin
|
|
GetValue:=((FData[Fh])[Fp]).Value;
|
|
GetValue:=((FData[Fh])[Fp]).Value;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function THashmapIterator.GetMutable:PValue;inline;
|
|
|
|
+begin
|
|
|
|
+ GetMutable:=@((FData[Fh]).Mutable[Fp]^.Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure THashmapIterator.SetValue(value:TValue);inline;
|
|
procedure THashmapIterator.SetValue(value:TValue);inline;
|
|
begin
|
|
begin
|
|
((FData[Fh]).mutable[Fp])^.Value := value;
|
|
((FData[Fh]).mutable[Fp])^.Value := value;
|