Espacios de nombres
Variantes
Acciones

std::collate

De cppreference.com
< cpp‎ | locale
 
 
 
std::collate
Las funciones miembro
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.
 
Definido en el archivo de encabezado <locale>
template< class CharT >
class collate;
Clase std::collate encapsula la configuración regional específica cotejo (comparación) y hash de cadenas. Esta faceta es utilizado por std::basic_regex y se puede aplicar, por medio de std::locale::operator(), directamente a todos los algoritmos estándar que esperan un predicado de comparación cadena .
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.
cpp/locale/locale/facetstd-collate-inheritance.svg
Acerca de esta imagen

Inheritance diagram

Dos especializaciones son proporcionados por la biblioteca estándar y son aplicadas por todos los objetos creados en un entorno nacional C + + programa:
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.
Definido en el archivo de encabezado <locale>
std::collate<char>
implementos orden lexicográfico de cadenas de bytes
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>
implementos orden lexicográfico de cadenas anchas
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.

Contenido

[editar] Tipos de miembros

Miembro de 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>

[editar] Las funciones miembro

construye una nueva faceta cotejo
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.

(función miembro pública)
destructs una faceta cotejo
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.

(función miembro protegida)
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.

(función miembro pública) [editar]
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.

(función miembro pública) [editar]
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.

(función miembro pública) [editar]

[editar] Objetos miembros

static std::locale::id id
Identificador de la configuración regional
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.

(objeto miembro público)

[editar] Protegido funciones miembro

[virtual]
compara dos cadenas mediante reglas de esta faceta de la clasificación
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.

(función miembro virtual protegida) [editar]
[virtual]
transforma una cadena para que intercalación puede ser sustituido por comparación
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.

(función miembro virtual protegida) [editar]
[virtual]
genera un valor hash entero utilizando las reglas esta faceta de intercalación
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.

(función miembro virtual protegida) [editar]

[editar] Ejemplo

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

Salida:

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

[editar] Ver también

Compara lexicográficamente dos cadenas utilizando la faceta de intercalación de esta configuración regional.
(función miembro pública de std::locale) [editar]
crea una faceta cotejar el nombre de la configuración regional
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.

(plantilla de clase)