std::collate::transform, std::collate::do_transform
De cppreference.com
![]() |
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
Definido en el archivo de encabezado <locale>
|
||
public: string_type transform( const CharT* low, const CharT* high ) const; |
(1) | |
protected: string_type do_transform( const CharT* low, const CharT* high ) const; |
(2) | |
función miembro pública, llama a la función virtual protegido
2) do_transform
miembro de la clase más derivada .Original:
public member function, calls the protected virtual member function
do_transform
of the most derived class.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Convierte el
[low, high)
secuencia de caracteres en una cadena que, en comparación lexicográficamente (por ejemplo, con operator<
para cadenas) con el resultado de la llamada transform()
en otra cadena, produce el mismo resultado como llamar do_compare()
en los mismos dos cadenas .Original:
Converts the character sequence
[low, high)
to a string that, compared lexicographically (e.g. with operator<
for strings) with the result of calling transform()
on another string, produces the same result as calling do_compare()
on the same two strings.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Contenido |
[editar] Parámetros
low | - | puntero al primer carácter de la secuencia a transformar
Original: pointer to the first character in the sequence to transform The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
high | - | uno pasado el puntero del extremo de la secuencia para transformar
Original: one past the end pointer for the sequence to transform The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[editar] Valor de retorno
La cadena transformada para que la comparación lexicográfica de las cadenas transformadas puede ser utilizado en lugar de una recopilación de los originales. En la localización "C", la cadena devuelta es la copia exacta de
[low, high)
. En otros lugares, el contenido de la cadena devuelta son definido por la implantación, y el tamaño puede ser considerablemente más largo .Original:
The string transformed so that lexicographic comparison of the transformed strings may be used instead of collating of the originals. In the "C" locale, the returned string is the exact copy of
[low, high)
. In other locales, the contents of the returned string are implementation-defined, and the size may be considerably longer.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Notas
Además de la utilización en la intercalación, el formato específico de la implementación de la cadena transformada se sabe que std :: regex_traits <> :: transform_primary, que es capaz de extraer la información de clase de equivalencia .
Original:
In addition to the the use in collation, the implementation-specific format of the transformed string is known to std :: regex_traits <> :: transform_primary, which is able to extract the equivalence class information.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Ejemplo
Ejecuta este código
#include <iostream> #include <iomanip> #include <locale> int main() { std::locale::global(std::locale("sv_SE.utf8")); auto& f = std::use_facet<std::collate<wchar_t>>(std::locale()); std::wstring in1 = L"\u00e4ngel"; std::wstring in2 = L"\u00e5r"; std::wstring out1 = f.transform(&in1[0], &in1[0] + in1.size()); std::wstring out2 = f.transform(&in2[0], &in2[0] + in2.size()); std::wcout << "In the Swedish locale: "; if(out1 < out2) std::wcout << in1 << " before " << in2 << '\n'; else std::wcout << in2 << " before " << in1 << '\n'; std::wcout << "In lexicographic comparison: "; if(in1 < in2) std::wcout << in1 << " before " << in2 << '\n'; else std::wcout << in2 << " before " << in1 << '\n'; }
Salida:
In the Swedish locale: år before ängel In lexicographic comparison: ängel before år
[editar] Ver también
Transforma una cadena para que strcmp produzca el mismo resultado que strcoll (función) | |
Transforma una cadena ancha para que wcscmp produzca el mismo resultado que wcscoll (función) |