libstdc++/3552: missing hash function for std::string

Phil Edwards phil@jaj.com
Mon Apr 29 12:16:00 GMT 2002


The following reply was made to PR libstdc++/3552; it has been noted by GNATS.

From: Phil Edwards <phil@jaj.com>
To: Vadim Ogranovich <vograno@arbitrade.com>
Cc: "'goswin.brederlow@student.uni-tuebingen.de'" <goswin.brederlow@student.uni-tuebingen.de>,
   "'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>,
   "'Laurent.Bonnaud@inpg.fr'" <Laurent.Bonnaud@inpg.fr>,
   "'87063-quiet@bugs.debian.org'" <87063-quiet@bugs.debian.org>,
   "'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>
Subject: Re: libstdc++/3552: missing hash function for std::string
Date: Mon, 29 Apr 2002 15:09:32 -0400

 On Sat, Apr 27, 2002 at 02:37:52PM -0500, Vadim Ogranovich wrote:
 > Hi, I independently came across this bug. It seems like it was classified as
 > not a bug with no workaround posted. Is that the case? Thanks, Vadim
 
 Yes.  How can we possibly guess what a good hash function would be for
 arbitrary strings?  Efficiency of hashing is extremely dependant on the
 data being hashed.  You need to write one that's appropriate for your data;
 this will involve multiple experiments.
 
 There is std::collate::hash() for char*'s, but this is essentially a
 generic guess, and should only be used when you haven't yet had the time
 to come up with a more appropriate function.
 
 -- 
 If ye love wealth greater than liberty, the tranquility of servitude greater
 than the animating contest for freedom, go home and leave us in peace.  We seek
 not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
 and may posterity forget that ye were our countrymen.            - Samuel Adams



More information about the Gcc-prs mailing list