comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthewjheaney@earthlink.net>
Subject: Re: hashed_maps
Date: Fri, 14 Oct 2005 04:41:35 GMT
Date: 2005-10-14T04:41:35+00:00	[thread overview]
Message-ID: <u64s07ls8.fsf@earthlink.net> (raw)
In-Reply-To: 1129217108.662259.56960@o13g2000cwo.googlegroups.com

"Lucretia" <lucretia9@lycos.co.uk> 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 "=".



  parent reply	other threads:[~2005-10-14  4:41 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           ` hashed_maps Lucretia
2005-10-13 19:47             ` hashed_maps Simon Wright
2005-10-14  4:35               ` hashed_maps Matthew Heaney
2005-10-14  4:41             ` Matthew Heaney [this message]
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