|
@@ -75,7 +75,9 @@ type
|
|
function FindGreater(key:TKey):TIterator;inline;
|
|
function FindGreater(key:TKey):TIterator;inline;
|
|
function FindGreaterEqual(key:TKey):TIterator;inline;
|
|
function FindGreaterEqual(key:TKey):TIterator;inline;
|
|
function GetValue(key:TKey):TValue;inline;
|
|
function GetValue(key:TKey):TValue;inline;
|
|
|
|
+ function GetMutableValue(key:TKey):PTValue;inline;
|
|
function TryGetValue(key:TKey; out Value: TValue): boolean;inline;
|
|
function TryGetValue(key:TKey; out Value: TValue): boolean;inline;
|
|
|
|
+ function TryGetMutableValue(key:TKey;out pvalue:PTValue):boolean;inline;
|
|
procedure Insert(key:TKey; value:TValue);inline;
|
|
procedure Insert(key:TKey; value:TValue);inline;
|
|
function InsertAndGetIterator(key:TKey; value:TValue):TIterator;inline;
|
|
function InsertAndGetIterator(key:TKey; value:TValue):TIterator;inline;
|
|
function Min:TIterator;inline;
|
|
function Min:TIterator;inline;
|
|
@@ -180,6 +182,18 @@ begin
|
|
GetValue:=FSet.NFind(Pair)^.Data.Value;
|
|
GetValue:=FSet.NFind(Pair)^.Data.Value;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TMap.GetMutableValue(key:TKey):PTValue;inline;
|
|
|
|
+var Pair:TPair;
|
|
|
|
+ Node:TMSet.PNode;
|
|
|
|
+begin
|
|
|
|
+ Pair.Key:=key;
|
|
|
|
+ Node:=FSet.NFind(Pair);
|
|
|
|
+ if Node=nil then
|
|
|
|
+ result:=nil
|
|
|
|
+ else
|
|
|
|
+ result:=@Node^.Data.Value;
|
|
|
|
+end;
|
|
|
|
+
|
|
function TMap.TryGetValue(key: TKey; out Value: TValue): boolean;
|
|
function TMap.TryGetValue(key: TKey; out Value: TValue): boolean;
|
|
var Pair:TPair;
|
|
var Pair:TPair;
|
|
Node: TMSet.PNode;
|
|
Node: TMSet.PNode;
|
|
@@ -191,6 +205,14 @@ begin
|
|
Value := Node^.Data.Value;
|
|
Value := Node^.Data.Value;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TMap.TryGetMutableValue(key:TKey;out pvalue:PTValue):boolean;
|
|
|
|
+var Pair:TPair;
|
|
|
|
+ Node:TMSet.PNode;
|
|
|
|
+begin
|
|
|
|
+ pvalue:=GetMutableValue(key);
|
|
|
|
+ Result:=pvalue<>nil;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TMap.Insert(key:TKey; value:TValue);inline;
|
|
procedure TMap.Insert(key:TKey; value:TValue);inline;
|
|
var Pair:TPair;
|
|
var Pair:TPair;
|
|
begin
|
|
begin
|