libstdc++/3552: missing hash function for std::string
Goswin Brederlow
goswin.brederlow@student.uni-tuebingen.de
Wed May 8 10:02:00 GMT 2002
Phil Edwards <phil@jaj.com> writes:
> 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
Actually the bug was more on the line that the STL _does_ guess for
char* but not for string and that it should use the char* hash
function for strings too.
> 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.
Having one for char* but not for string is a bit of a contradiction.
MfG
Goswin
More information about the Gcc-bugs
mailing list