public member function


template <class ForwardIterator>
  string_type transform (ForwardIterator first, ForwardIterator last) const;
Transform to string
Returns a string with a collating key that represents the character sequence between first and last using locale-sensitive information.

For the standard regex_traits, the string constructor is used and the appropriate collate::transform facet is applied on it:
template <class ForwardIterator>
  string_type transform (ForwardIterator first, ForwardIterator last) const {
    string_type s (first,last);  
    return use_facet< collate<char_type> >(getloc()).transform(&*s.begin(),&*s.begin()+s.length());

This function is called when a regular expression needs to match a range (e.g., [a-z]) against a character with locale-specific information: Generally, to match the character x against the range [a-z], a lexicographical comparison is performed by checking whether a<=x && x<=z. When the regex object has collate as a syntax option, all the characters and collating elements involved in the comparison are first transformed using this function.

The function takes a range instead of a single character to accommodate for multi-character collating elements.

A custom traits class can define a different transformation producing string values that are ordered differently when compared lexicographically.


first, last
Forward iterators to the initial and final positions in a sequence of characters. The range used is [first,last), which includes all the characters between first and last, including the character pointed by first but not the character pointed by last.

Return value

The string transformation of the sequence of characters.
string_type is a member type, alias of its corresponding string type. In regex_traits it is an alias of the basic_string with the same template parameter (e.g., string for regex_traits<char>).

See also