Thank you, this is a good base. But I need it a little bit more abstract. Mainly, I also need reference counting on the objects (interfaces now) I saved there. :)
Yes, I can call _AddRef and _Release by myself, but this doesn't look very nice.

And in future, I want to use other sort of key elements (eg strings). It would be nice if I can select any hash-function (a function, which maps my object to an integer) for my key objects so that I can use everything as keys. The code has to be extended a little bit to handle collisions.
If I find the time, I can do this.

And Burkhard is right, this should be merged into the FPL tree.

Albert


Am Donnerstag, den 17.08.2006, 11:25 +0200 schrieb Mattias:
On Thu, 17 Aug 2006 11:16:58 +0000
Albert Zeyer <[EMAIL PROTECTED]> wrote:

> Which one do you mean? I only find there a few special lists.
> 
> But I need an implementation of a map (key elements map to some data),
> implemented with B-trees or similar (the key elements need to be
> hashed for this), like hash_map in STL. In my case, I don't need a
> special hash function because my key elements are object pointers.

lcl/avglvltree.pas has TPointerToPointerTree
Usage:
  Tree:=TPointerToPointerTree.Create;
  Tree[SomePointer]:=SomeData;
  Value:=Tree[SomePointer];


Mattias



> 
> Albert.
> 
> 
> Am Donnerstag, den 17.08.2006, 08:08 +0200 schrieb Michael Van
> Canneyt:
> 
> > 
> > On Thu, 17 Aug 2006, Albert Zeyer wrote:
> > 
> > > Hi there.
> > >
> > > Is there any HashMap-implementation in the units of FPC? I didn't
> > > find one. Is an implemenentation missing till now? How can you
> > > life without it? :)
> > 
> > There is a hash implementation in the contnrs unit, but I don't
> > know if this is suitable for your purposes.
> > 
> > Michael.
> > 
> > _________________________________________________________________
> >      To unsubscribe: mail [EMAIL PROTECTED] with
> >                 "unsubscribe" as the Subject
> >    archives at http://www.lazarus.freepascal.org/mailarchives
> > 

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to