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>| 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.
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.
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.
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.
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) | |
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) | |