Espaces de noms
Variantes
Affichages
Actions

std::collate::transform, std::collate::do_transform

De cppreference.com
< cpp‎ | locale‎ | collate

 
 
Bibliothèque localisations
Locales et facettes
Original:
Locales and facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale
Classification des caractères
Original:
Character classification
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Conversions
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Classes de facettes catégorie de base
Original:
Facet category base classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Catégories de facettes
Original:
Facet categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Spécifique aux paramètres régionaux facettes
Original:
Locale-specific facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Facettes de conversion de code
Original:
Code conversion facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
codecvt_utf8 (C++11)
codecvt_utf16 (C++11)
C locale
Original:
C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
std::collate
Les fonctions membres
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
collate::collate
collate::~collate
collate::compare
collate::do_compare
collate::transform
collate::do_transform
collate::hash
collate::do_hash
 
Defined in header <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.
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.

Sommaire

[modifier] 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.

[modifier] 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.

[modifier] 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.

[modifier] 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

[modifier] 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) [edit]
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) [edit]