std::collate::transform, std::collate::do_transform
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody>| Déclaré dans l'en-tête <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) | |
1)
fonction de membre du public, appelle le protégé
do_transform virtuelle fonction membre de la classe la plus dérivée .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.
2)
Convertit le
[low, high) séquence de caractères à une chaîne qui, comparées lexicographiquement (par exemple avec operator< pour les chaînes) avec le résultat de l'appel transform() sur une autre chaîne, produit le même résultat que l'appel do_compare() sur les deux mêmes chaînes .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.
Paramètres
| low | - | pointeur vers le premier caractère de la séquence de transformation
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 | - | une extrémité antérieure du pointeur de la séquence de transformation
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. |
Retourne la valeur
La chaîne transformée sorte que la comparaison lexicographique des chaînes transformées peut être utilisé à la place de rassembler des originaux. Dans le "C", la chaîne retournée est la copie exacte de
[low, high). Dans d'autres endroits, le contenu de la chaîne retournée est définie par l'implémentation, et la taille peut être beaucoup plus .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.
Notes
En plus de l'utilisation de l'assemblage dans le format spécifique à l'implémentation de la chaîne de transformation est connue pour std :: regex_traits <> :: transform_primary, qui est en mesure d'extraire l'information de classe d'équivalence .
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.
Exemple
#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';
}
Résultat :
In the Swedish locale: år before ängel
In lexicographic comparison: ängel before år
Voir aussi
transformer une chaîne de sorte que strcmp produirait le même résultat que strcoll Original: transform a string so that strcmp would produce the same result as strcoll The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |
transformer une chaîne large, afin que wcscmp produirait le même résultat que wcscoll Original: transform a wide string so that wcscmp would produce the same result as wcscoll The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction) | |