David Harmon wrote:
> On Wed, 14 Apr 2004 20:54:05 GMT in comp.lang.c++, Kevin Goodsell
> <> wrote,
>
>>Does anyone know what will need to be provided in order to hash on a
>>particular type? std::map requires a less-than comparison operation --
>>what operations would a hash-based map need?
>
>
> Mainly, a hashing function that takes a argument of type Key
> and returns an int.
>
> http://std.dkuug.dk/jtc1/sc22/wg21/d...003/n1443.html
>
(Having only glanced over the link so far...)
I thought maybe they'd supply a hashing function that you can use, for
example if there's an operator<<(ostream &, const Key&). The string
representation could be generated with that and hashed. Since the
proposal includes a hash function for std::string, I suppose it would be
fairly easy to create this yourself.
I don't know how well this would work in practice, though. Obviously the
printed form of the Key would need to be unique.
-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.