hash_map<char*,T> default EqualKey

Marco Morandini morandini@aero.polimi.it
Mon May 21 05:02:00 GMT 2001


As pointed out in 

http://gcc.gnu.org/ml/gcc-bugs/1998-02/msg00383.html

while hash_map<char*,T> has a default has_function
which is based on the contents of the string,
its equality function defaults to equal_key<char*>, which is based
on the address of the string and not on his contents.
I found this quite misleading.
Would not be better to have equal_to<char*> (as well as
not_equal_to, greater, less, greater_equal and less_equal) specialized
with strcmp and not leave this to the user?
Will this break something else?

Thanks,

Marco Morandini



More information about the Libstdc++ mailing list