Multi-byte characters are compared appropriately.
For the standard specialization of char and wchar_t the function returns the same as lexicographical_compare, which performs a character code (ASCII) comparison between the individual characters of both sequences, returning an alphabetical ordering for alphabetical strings.
During its operation, the version of this function in the generic template simply calls the virtual protected member do_compare, which is the member function in charge of performing the actions described above.
Parameters
- low1, high1
- Pointer to the beginning and ending characters of the first sequence. The range used is [low1,high1), which contains all the characters between low1 and high1, including the character pointed by low1 but not the character pointed by high1.
charT is the template parameter (i.e., the facet's character type). - low2, high2
- Pointer to the beginning and ending characters of the second sequence. The range used is [low2,high2).
Return value
1 if the first string is greater than the second.-1 if the first string is less than the second.
0 otherwise (i.e., they are considered equal).
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
Output:
STRAWBERRY is greater than BLUEBERRY |
See also
| collate::transform | Transform character sequence (public member function) |
| collate::hash | Get hash value (public member function) |
| lexicographical_compare | Lexicographical less-than comparison (function template) |
