std::collate
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <locale>
|
||
template< class CharT > class collate; |
||
Classe std::collate incapsula specifiche delle impostazioni internazionali di confronto (confronto) e hashing delle stringhe. Questo aspetto è utilizzato da std::basic_regex e può essere applicato, mediante std::locale::operator(), direttamente a tutti gli algoritmi standard che prevedono un predicato confronto di stringhe.
Original:
Class std::collate encapsulates locale-specific collation (comparison) and hashing of strings. This facet is used by std::basic_regex and can be applied, by means of std::locale::operator(), directly to all standard algorithms that expect a string comparison predicate.
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.
Due specializzazioni sono forniti dalla libreria standard e sono attuate da tutti gli oggetti delle impostazioni locali creati in un programma C + +:
Original:
Two specializations are provided by the standard library and are implemented by all locale objects created in a C++ program:
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.
Definizione nell'header
<locale> | |
std::collate<char> | strumenti lessicografici ordinamento delle stringhe di byte
Original: implements lexicographical ordering of byte strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
std::collate<wchar_t> | strumenti lessicografici ordinamento di stringhe larghe
Original: implements lexicographical ordering of wide strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Indice |
[modifica] Membri tipi
Membro tipo
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
char_type
|
charT
|
string_type
|
std::basic_string<charT>
|
[modifica] Membri funzioni
costruisce un nuovo aspetto di fascicolazione Original: constructs a new collate facet The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
distrugge una sfaccettatura di fascicolazione Original: destructs a collate facet The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (protetto funzione membro) | |
Invoca do_compare Original: invokes do_compare The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
Invoca do_transform Original: invokes do_transform The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
Invoca do_hash Original: invokes do_hash The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) |
[modifica] Membri oggetti
static std::locale::id id |
' Id del locale Original: id of the locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (attributo pubblico) |
[modifica] Protetto funzioni membro
[virtuale] |
confronta due stringhe utilizzando le regole di confronto di questa faccetta Original: compares two strings using this facet's collation rules The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (virtuale protetto funzione membro) |
[virtuale] |
trasforma una stringa in modo che confronto può essere sostituito da confronto Original: transforms a string so that collation can be replaced by comparison The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (virtuale protetto funzione membro) |
[virtuale] |
genera un valore intero hash utilizzando le regole di confronto di questa faccetta Original: generates an integer hash value using this facet's collation rules The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (virtuale protetto funzione membro) |
[modifica] Esempio
#include <locale> #include <iostream> #include <string> #include <vector> #include <algorithm> int main() { std::wcout.imbue(std::locale("")); std::vector<std::wstring> v = {L"ar", L"zebra", L"\u00f6grupp", L"Zebra", L"\u00e4ngel", L"\u00e5r", L"f\u00f6rnamn"}; std::wcout << "Default locale collation order: "; std::sort(v.begin(), v.end()); for(auto s : v) std::wcout << s << ' '; std::wcout << '\n'; std::wcout << "English locale collation order: "; std::sort(v.begin(), v.end(), std::locale("en_US.UTF-8")); for(auto s : v) std::wcout << s << ' '; std::wcout << '\n'; std::wcout << "Swedish locale collation order: "; std::sort(v.begin(), v.end(), std::locale("sv_SE.UTF-8")); for(auto s : v) std::wcout << s << ' '; std::wcout << '\n'; }
Output:
Default locale collation order: Zebra ar förnamn zebra ängel år ögrupp English locale collation order: ängel ar år förnamn ögrupp zebra Zebra Swedish locale collation order: ar förnamn zebra Zebra år ängel ögrupp
[modifica] Vedi anche
lexicographically compares two strings using this locale's collate facet (metodo pubblico) | |
crea un aspetto di fascicolazione per la versione locale di nome Original: creates a collate facet for the named locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |