From: Daniel James (daniel_at_[hidden])
Date: 2005-03-09 10:33:46


Peter Dimov wrote:

> Do not give much weight to such char_traits definitions, issue 6.17
> notwithstanding. The proposed extensions treat std::string as a
> container, not as... whatever the other aspect of std::string is
> supposed to be. That is, the hash value of a string s is defined as the
> hash value of the range s.begin(), s.end().
>
> If you look at the container requirements table, you'll see that
> container equality is defined in terms of operator== on the elements.
>
> The (bold enough) author of a string that is not a container can provide
> an overload of hash_value (in the namespace of the corresponding traits
> class) with the appropriate semantics.

Well, partly I just feel like I should go along with the current opinion
of the standards comittee. But here I do agree with them.

'std::equal_to<std::string>' is defined as using char_traits. And if the
hash function doesn't match std::equal_to, then I believe it's broken.
Regardless of whether using char_traits was a bad idea in the first place.

Having said that, it is your design, so your opinion is very important.