From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a8c6c308ebb6a246 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail From: "Lucretia" Newsgroups: comp.lang.ada Subject: Re: hashed_maps Date: 13 Oct 2005 08:25:08 -0700 Organization: http://groups.google.com Message-ID: <1129217108.662259.56960@o13g2000cwo.googlegroups.com> References: <1129046337.130908.137510@g47g2000cwa.googlegroups.com> <1129136684.840004.135310@g47g2000cwa.googlegroups.com> <1129214713.115873.151280@o13g2000cwo.googlegroups.com> <1129215331.736043.8600@g44g2000cwa.googlegroups.com> NNTP-Posting-Host: 194.74.199.42 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1129217113 20732 127.0.0.1 (13 Oct 2005 15:25:13 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 13 Oct 2005 15:25:13 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 Symantec_Web_Security (3.0.1.74), 1.0 C2100-0050414028 (NetCache NetApp/5.5R5) Complaints-To: groups-abuse@google.com Injection-Info: o13g2000cwo.googlegroups.com; posting-host=194.74.199.42; posting-account=G-J9fgwAAADgpzBiEyy5tO4f8MX5fbpw Xref: g2news1.google.com comp.lang.ada:5598 Date: 2005-10-13T08:25:08-07:00 List-Id: 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.