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 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!news4.google.com!news.glorb.com!news.astraweb.com!news-router2.astraweb.com!207.217.77.102.MISMATCH!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: Matthew Heaney@MHEANEYIBMT43 Newsgroups: comp.lang.ada Subject: Re: hashed_maps 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> <1129217108.662259.56960@o13g2000cwo.googlegroups.com> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 14 Oct 2005 04:41:35 GMT NNTP-Posting-Host: 24.149.57.125 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1129264895 24.149.57.125 (Thu, 13 Oct 2005 21:41:35 PDT) NNTP-Posting-Date: Thu, 13 Oct 2005 21:41:35 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:5628 Date: 2005-10-14T04:41:35+00:00 List-Id: "Lucretia" writes: > 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. The container standard guarantees that associative containers must perform better than O(n), so a linked list would not be an acceptable implementation. It's probably quicker and easier to use the ordered map, since the "<" operator for type Address is declared right there in package System. If you want to use a hash table, then you can use To_Integer declared in System.Storage_Elements to implement a hash function for type Adddress. The generic actual for Equivalent_Keys is just "=".