Espacios de nombres
Variantes
Acciones

std::regex_traits::transform_primary

De cppreference.com
< cpp‎ | regex‎ | regex traits
 
 
Biblioteca de expresiones regulares
Clases
(C++11)
Algoritmos
Iteradores
Excepciones
Rasgos
Constantes
(C++11)
Gramática de las expresiones regulares
 
 
template<class ForwardIt >
string_type transform_primary( ForwardIt first, ForwardIt last)const
Obtiene el primario (caso ignorando, diacríticos, variante, etc) clave de clasificación para la secuencia de caracteres [first, last), de manera que si una clave de ordenación primaria compara menor que otra clave de ordenación primaria con operator<, la secuencia de caracteres que produjo la primera clave de ordenación viene antes la secuencia de caracteres que produjo la segunda clave de ordenación, para la configuración regional seleccionada imbuido de cotejo principal .
Original:
Obtains the primary (ignoring case, diacritics, variant, etc) sort key for the character sequence [first, last), such that if a primary sort key compares less than another primary sort key with operator<, then the character sequence that produced the first sort key comes before the character sequence that produced the second sort key, in the currently imbued locale's primary collation order.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
La biblioteca regex utiliza esta característica para que coincida con personajes contra clases de equivalencia. Por ejemplo, la expresión regular [[=a=]] es equivalente al carácter c1 si traits.transform_primary(c1) es equivalente a traits.transform_primary("a") (lo cual es cierto para cualquier c1 de "AÀÁÂÃÄÅaàáâãäå"). Tenga en cuenta que transform_primary() toma un argumento de secuencia de caracteres ya que las clases de equivalencia pueden ser varios caracteres, como [[=ll=]] .
Original:
The regex library uses this trait to match characters against equivalence classes. For example, the regex [[=a=]] is equivalent to the character c1 if traits.transform_primary(c1) is equivalent to traits.transform_primary("a") (which is true for any c1 from "AÀÁÂÃÄÅaàáâãäå"). Note that transform_primary() takes a character sequence argument because equivalence classes may be multicharacter, such as [[=ll=]].
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
No hay manera portátil para definir clave de clasificación primario en términos de std::locale puesto que la conversión de la clave intercalación devuelto por std::collate::transform() a la clave primaria de equivalencia es específico del entorno local, y si el usuario reemplaza la faceta std::collate, que la conversión ya no se sabe de la biblioteca estándar std::regex_traits. Especializaciones biblioteca estándar de std::regex_traits devolverá una cadena vacía a menos que la faceta std::collate de la localidad actualmente imbuidos no fue reemplazada por el usuario, y sigue coincidiendo con el suministrado por el sistema faceta std::collate), en cuyo caso se ejecuta std::collate_byname<charT>::transform(first, last) y es la clave de ordenación que produce convierte en la clave de ordenación primaria esperada utilizando una conversión de la configuración regional específica .
Original:
There is no portable way to define primary sort key in terms of std::locale since the conversion from the collation key returned by std::collate::transform() to the primary equivalence key is locale-specific, and if the user replaces the std::collate facet, that conversion is no longer known to the standard library's std::regex_traits. Standard library specializations of std::regex_traits return an empty string unless the std::collate facet of the currently-imbued locale was not replaced by the user, and still matches the system-supplied std::collate facet), in which case std::collate_byname<charT>::transform(first, last) is executed and the sort key it produces is converted to the expected primary sort key using a locale-specific conversion.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar]Parámetros

first, last -
un par de los iteradores que determina la secuencia de caracteres a comparar
Original:
a pair of iterators which determines the sequence of characters to compare
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Requisitos de tipo
-
ForwardIt debe reunir los requerimientos de ForwardIterator.

[editar]Valor de retorno

La clave de ordenación primaria para la [first, last) secuencia de caracteres en la configuración regional seleccionada impregnada, ignorando caso, variante, signos diacríticos, etc
Original:
The primary sort key for the character sequence [first, last) in the currently imbued locale, ignoring case, variant, diacritics, etc.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar]Ejemplo

Demuestra la función regex que funciona a través de transform_primary ()
Original:
Demonstrates the regex feature that works through transform_primary()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>#include <regex>   int main(){std::locale::global(std::locale("en_US.UTF-8"));std::wstring str = L"AÀÁÂÃÄÅaàáâãäå";std::wregex re(L"[[=a=]]*", std::regex::basic);std::cout<<std::boolalpha<<std::regex_match(str, re)<<'\n';}

Salida:

true
close