cpp/regex/regex traits/lookup collatename

If the character sequence represents the name of a valid collating element in the currently imbued locale, returns the name of that collating element. Otherwise, returns an empty string.

Collating elements are the symbols found in POSIX regular expressions between and. For example, matches the character  in the C locale. matches the character in the C locale as well. matches the digraph in Czech locale, but generates std with error code std in most other locales.

Return value
The representation of the named collating element as a character string.

Example
{{example
 * code=
 * 1) include
 * 2) include
 * 3) include

struct noisy_traits : std::regex_traits {   template< class Iter > string_type lookup_collatename( Iter first, Iter last ) const {       string_type result = regex_traits::lookup_collatename(first, last); std::cout << "regex_traits<>::lookup_collatename(\""                 << string_type(first, last)                  << "\") returns \"" << result << "\"\n"; return result; } };

int main {   std::string str = "z{{!}}}a"; // C locale collation order: x,y,z,{,{{!}},},~ std::basic_regex re("[x-[.tilde.]]*a", std::regex::basic); std::cout << std::boolalpha << std::regex_match(str, re) << '\n'; } regex_traits<>::lookup_collatename("tilde") returns "~" true }}
 * p=true
 * output=