help
Max Lawson
mlawson@drfmc.ceng.cea.fr
Thu Feb 19 14:17:00 GMT 1998
Thanx all for your answers
> This needs to be something like:
>
> hash_map< const char*, int,hash<const char*>,equal_to<string> > hm;
>
> The problem you're encountering is that while I the hash function is presumably
> finding the right string in the hash map, the equality comparison you're using
> -- equals_to<const char*> -- is only comparing the ADDRESS of the
> string-pointers, not the strings they point to.
> --
> Ian Haggard || ian@shellus.com (work) || IanHaggard@juno.com (home)
> GNU/Linux -- "Oh, no, Mr Bill!" || #define employer_opinion !my_opinion
>
You get it :-). But, instead of using the equal_to<string> construct I'm
going to provide a new one in order to avoid temporaries (a wrapper to
strcmp()).
Regards, Max
More information about the Gcc-bugs
mailing list