std::regex_traits::transform_primary
Da cppreference.com.
< cpp | regex | regex traits
![]() |
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. |
template< class ForwardIt > string_type transform_primary( ForwardIt first, ForwardIt last) const |
||
Ottiene il primario (ignorando caso, segni diacritici, variante, ecc), chiave di ordinamento per la sequenza di caratteri
[first, last)
, in modo tale che se una chiave di ordinamento primaria confronta minore di un altro chiave di ordinamento primaria con operator<, quindi la sequenza di caratteri che ha prodotto la prima chiave ordinamento viene prima la sequenza di caratteri che ha prodotto la seconda chiave di ordinamento, per le regole di confronto di base alle impostazioni internazionali attualmente imbevuta di.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.
You can help to correct and verify the translation. Click here for instructions.
La libreria regex utilizza questa caratteristica per corrispondere a caratteri contro classi di equivalenza. Per esempio, il [[=a=]] regex è equivalente al carattere
c1
se traits.transform_primary(c1) è equivalente a traits.transform_primary("a") (che è vero per qualsiasi c1
da "AÀÁÂÃÄÅaàáâãäå"). Si noti che transform_primary()
prende un argomento sequenza di caratteri perché le classi di equivalenza può essere multicarattere, come [[=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.
You can help to correct and verify the translation. Click here for instructions.
Non vi è alcun modo comune per definire chiave primaria liste in termini di std::locale poiché la conversione dalla chiave di confronto restituito da std::collate::transform() alla chiave primaria equivalenza delle specifiche internazionali, e se l'utente sostituisce la faccetta std::collate, che la conversione non è più noto la libreria standard di std::regex_traits. Specializzazioni libreria standard di std::regex_traits restituire una stringa vuota a meno che l'aspetto std::collate del locale attualmente imbevuta non è stato sostituito dall'utente, e corrisponde ancora il sistema fornita sfaccettatura std::collate), nel qual caso std::collate_byname<charT>::transform(first, last) viene eseguito e la chiave di ordinamento che produce è convertito alla chiave atteso ordinamento principale utilizzando un locale specifico per la conversione.
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.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Parametri
first, last | - | una coppia di iteratori che determina la sequenza di caratteri da confrontare
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. |
Type requirements | ||
-ForwardIt must meet the requirements of ForwardIterator .
|
[modifica] Valore di ritorno
La chiave di ordinamento primaria per la
[first, last)
sequenza di caratteri nel locale attualmente intriso, ignorando caso, variante, segni diacritici, ecc 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.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Esempio
Viene illustrata la funzione regex che opera attraverso 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.
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'; }
Output:
true
This section is incomplete Reason: could use an example with user-defined regex_traits supplying user-defined transform_primary |