A hash for a string is a value that uniquely* identifies the content of the string, so that two strings with the same hash value, would compare equal by collate::compare, and two strings with different hash values would compare not equal.
Thus, two strings can be easily compared for equality by simply comparing their hash values, which are of an integer type.
During its operation, the version of this function in the generic template simply calls the virtual protected member do_transform, which is the member function in charge of performing the actions described above.
* The uniqueness is relative to the possible values the hash type can take (in this case numeric_limits<unsigned long>::max()). Therefore, there is a very small probability that two strings with different contents have the same hash (generally, one in billions).
- low, high
- Pointers to the beginning and ending characters of the sequence. The range used is [low,high), which contains all the characters between low and high, including the character pointed by low but not the character pointed by high.
charT is the template parameter (i.e., the facet's character type).
Return valueAn integer value that identifies the content of the entire character sequence.
Please enter your favorite berry: strawberry Mine too!
|collate::compare||Compare character sequences (public member function)|