comp.lang.ada
 help / color / mirror / Atom feed
From: "Lucretia" <lucretia9@lycos.co.uk>
Subject: Re: hashed_maps
Date: 13 Oct 2005 08:25:08 -0700
Date: 2005-10-13T08:25:08-07:00	[thread overview]
Message-ID: <1129217108.662259.56960@o13g2000cwo.googlegroups.com> (raw)
In-Reply-To: 1129215331.736043.8600@g44g2000cwa.googlegroups.com

Ok...I have been developing a binding to wxWidgets, so as an example:

package wx.Core.Window is

  type Window_Type is new Event_Handler_Type with private;

  procedure New_Window(Self : in out Window_Type; ...);

end wx.Core.Window;

New_Window contains a function wxWindow_ctor which calls a C function
which in turn calls "new wxWindow(...)" and returns the C++ pointer to
the New_Window procedure. I was originally storing the address of the
Ada instance (using Address_To_Access_Conversions) in the C++ class,
but this was messy and I needed a generic way of doing this for every
instance created on the Ada side, so a mapping seemed like a good idea
(C++ pointer :-> Ada access type)*.

* The "Ada access type" is the address of the newly constructed Ada
instance, from, for example, New_Window!

Now, I just need to know that what I'm doing with the ordered map isn't
going to generate a linked list in which the search will end up linear
as new C++ types are allocated as the key will be the address of the
C++ instance. Should a hashed map be used, if so, how do you do this?
I've only seen examples of hashing with strings.

Thanks,
Luke.




  reply	other threads:[~2005-10-13 15:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-11 15:58 hashed_maps Lucretia
2005-10-11 17:45 ` hashed_maps Jeffrey R. Carter
2005-10-12 17:04   ` hashed_maps Lucretia
2005-10-13  5:17     ` hashed_maps Matthew Heaney
2005-10-13 14:45       ` hashed_maps Lucretia
2005-10-13 14:55         ` hashed_maps Matthew Heaney
2005-10-13 15:25           ` Lucretia [this message]
2005-10-13 19:47             ` hashed_maps Simon Wright
2005-10-14  4:35               ` hashed_maps Matthew Heaney
2005-10-14  4:41             ` hashed_maps Matthew Heaney
2005-10-17 15:48           ` hashed_maps Lucretia
2005-10-13 20:55 ` hashed_maps Björn Persson
2005-10-13 21:27   ` hashed_maps Robert A Duff
2005-10-14  4:49     ` hashed_maps Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox