{$ifdef fpc}{$mode delphi}{$H+}{$endif}
uses fgl;
type
TIntegerMap = TFPGMap<integer, integer>;
var
C:TIntegerMap;
K,V:array of integer;
I:integer;
begin
c := TIntegermap.Create;
try
c.Add(100,102);
c.Add(103,104);
// edit for comment: set the size of the arrays, and write the loop..
Setlength(K, c.Count);
Setlength(V, c.count);
for i := 0 to c.count-1 do
begin
K[i] := c.Keys[i];
V[i] := c.data[i];
end;
// The rest of the code in both examples is the same.
finally
for i in k do write('Key':8,i:8); // dump keys
writeln;
for i in v do write('Value':8,i:8); // dump values
c.Free;
end;
end.