Namensräume
Varianten
Aktionen

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

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

 
 
Lokalisierungen Bibliothek
Locales und Facetten
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
Buchstaben-Klassifikation
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.
Facet Kategorie Basisklassen
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.
Facet Kategorien
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.
Locale-spezifische Facetten
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.
Code-Konvertierung Facetten
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
Member-Funktionen
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)
öffentliche Member-Funktion ruft die geschützte virtuelle Member-Funktion do_transform der am meisten abgeleiteten Klasse .
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)
Konvertiert die Zeichenfolge [low, high) in einen String, dass lexikographisch (zB mit operator< für Streicher) mit dem Ergebnis des Aufrufs transform() auf einem anderen Zeichenfolge verglichen, erzeugt das gleiche Ergebnis wie der Aufruf do_compare() auf den gleichen zwei Strings .
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.

Inhaltsverzeichnis

[Bearbeiten] Parameter

low -
Zeiger auf das erste Zeichen in der Folge zu transformieren
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 -
ein über das Ende Zeiger für die Sequenz zu transformieren
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.

[Bearbeiten] Rückgabewert

Der String, so dass lexikographische Vergleich der transformierten Strings kann statt Zusammentragen der Originale verwendet werden umgewandelt. In der "C"-Locale, ist der zurückgegebene String der exakten Kopie [low, high). In anderen Ländern sind die Inhalte der zurückgegebenen Zeichenfolge Implementierung definiert, und die Größe kann deutlich mehr .
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.

[Bearbeiten] Notes

Neben dem Einsatz in der Kollation wird die Umsetzung-spezifischen Format des transformierten String std :: regex_traits <> :: transform_primary, die in der Lage, um die Gleichwertigkeit der Klasse zu extrahieren ist bekannt .
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.

[Bearbeiten] Beispiel

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

Output:

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

[Bearbeiten] Siehe auch

verwandeln einen String, so dass strcmp das gleiche Ergebnis wie strcoll erzeugen würde
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.

(Funktion) [edit]
Transformation ein breites String, so dass wcscmp das gleiche Ergebnis wie wcscoll erzeugen würde
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.

(Funktion) [edit]