[ Web Proxy ]
URL:
Viewing: https://fr.cppreference.com/cpp/locale/collate/transform [Back]  [Original]

std::collate::transform, std::collate::do_transform cppreference.com
cppreference.com
Espaces de noms
Variantes

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

De cppreference.com

<metanoindex/>

 
 
Bibliothque 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 caractres
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 catgorie 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.
Catgories 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.
Spcifique aux paramtres rgionaux 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
 
<tbody> </tbody>
Dclar dans l'en-tte <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 protg do_transform virtuelle fonction membre de la classe la plus drive .
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) squence de caractres une chane qui, compares lexicographiquement (par exemple avec operator< pour les chanes) avec le rsultat de l'appel transform() sur une autre chane, produit le mme rsultat que l'appel do_compare() sur les deux mmes chanes .
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.

Paramtres

low -
pointeur vers le premier caractre de la squence 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 extrmit antrieure du pointeur de la squence 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 chane transforme sorte que la comparaison lexicographique des chanes transformes peut tre utilis la place de rassembler des originaux. Dans le "C", la chane retourne est la copie exacte de [low, high). Dans d'autres endroits, le contenu de la chane retourne est dfinie par l'implmentation, 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.

Notes

En plus de l'utilisation de l'assemblage dans le format spcifique l'implmentation de la chane 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.

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';

}

Rsultat :

In the Swedish locale: r before ngel
In lexicographic comparison: ngel before r

Voir aussi

transformer une chane de sorte que strcmp produirait le mme rsultat 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 chane large, afin que wcscmp produirait le mme rsultat 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]

Web Proxy Viewer  |  New URL  |  Original Page