public member function
<locale>

std::collate::transform

string_type transform (const char_type* low, const char_type* high) const;
Transform character sequence
Returns a string object whose character values are such that when compared lexicographically with the character values resulting from calling this same function on another string, gives the same result as comparing the strings using collate::compare.

This allows to speed up comparisons when a single string needs to be collate compared to many other strings, since lexicographical comparisons (such as those performed by the lexicographical_compare algorithm) may be considerably faster than collate::compare on certain locales.

Internally, this function simply calls the virtual protected member do_transform, which for the classic locale on the default specializations returns a string with the same characters as the range, without performing any transformation.

Parameters

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.
Note that null characters (if any) are also transformed, and the function proceeds beyond them, until the entire range is converted.
Member type char_type is the facet's character type (defined as an alias of collate's template parameter, charT).

Return value

A string that, if compared lexicographically with the result of this same function on another string will return the same as comparing the two original strings with collate::compare.
Member type string_type is an instantiation of basic_string with the same character type as the facet (defined as an alias of basic_string<charT>, where charT is collate's template parameter).

Data races

The facet object and the characters in the range [low,high) are accessed.

Exception safety

Strong guarantee: No side effects in case an exception is thrown.

See also