Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-03-09 09:25:32


Daniel James wrote:
> Peter Dimov wrote:
>> Daniel James wrote:
>>> Oh dear, it's actually the header file that's out of date. I changed
>>> it because it won't work for custom character traits.
>>
>>
>> Why do you think so?
>
> That's issue 6.17 from n1756. I think you can define char_traits to
> create a case-insensitive string, so you'd want to get the same hash
> values for "foo" as "FOO".

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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk