[fpc-pascal] Hashmap for integers
Andreas Schneider
aksdb at gmx.de
Sun Aug 22 16:34:55 CEST 2010
On Sun, 22 Aug 2010 17:05:21 +0300, "Juha Manninen (gmail)"
<juha.manninen62 at gmail.com> wrote:
> Hi
>
> Is there an implementation of a hash map where the keys are integers. It
> is
> needed when the integers are too big for a lookup array.
> I only need check the existence of keys so the data type is not
important.
> About like this:
uses fgl;
type
TIntMap = specialize TFPGMap<Integer, Integer>; //Maps Int --> Int
> var
> Len: integer;
> SeenLen: TIntMap; // or whatever the type is called
>
> ...
>
> if not SeenLen.Has(Len) then begin
> ... work with Len ...
> SeenLen[Len] := nil; // If the data type is pointer
> end;
>
>
> A related question:
> What is the state of the generic containers now?
FPC 2.4.x should be fine with generics, although 2.5 is still more
advanced in that sector.
Best regards,
Andreas.
More information about the fpc-pascal
mailing list