std::regex_traits::isctype
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. |
bool isctype( CharT c, char_class_type f ) const; |
||
Determina se il carattere
c
appartiene alla classe di caratteri identificato da f
, che, a sua volta, è un valore restituito da lookup_classname()
.Original:
Determines whether the character
c
belongs to the character class identified by f
, which, in turn, is a value returned by lookup_classname()
.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 versione di questa funzione disponibile nelle specializzazioni della libreria standard di std::regex_traits, prima converte
f
ad alcuni m
valore temporaneo di tipo std::ctype_base::mask in attuazione definito modo, quindi tenta di classificare il personaggio nel locale impregnato chiamando std::use_facet<std::ctype<CharT>>(getloc()).is(m, c). Se questo ritorno true, true viene restituito da isctype()
. Altrimenti, controlla se c
uguale '_'
e f
maschera di bit corrispondente al [:w:]
classe di caratteri, in cui viene restituito true caso. In caso contrario, viene restituito false
.Original:
The version of this function provided in the standard library specializations of std::regex_traits, first converts
f
to some temporary value m
of type std::ctype_base::mask in implementation-defined manner, then attempts to classify the character in the imbued locale by calling std::use_facet<std::ctype<CharT>>(getloc()).is(m, c). If that returned true, true is returned by isctype()
. Otherwise, checks whether c
equals '_'
and the bitmask f
corresponds to the character class [:w:]
, in which case true is returned. Otherwise, false
is returned.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.
Nota: la norma è formulata in modo errato pubblicato, che richiedono questa funzione per restituire true per
'_'
in tutti i casi. Questo è LWG issue 2018.Original:
Note: the published standard is phrased incorrectly, requiring this function to return true for
'_'
in all cases. This is LWG issue 2018.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.
Indice |
[modifica] Parametri
c | - | il carattere da classificare
Original: the character to classify The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
f | - | la maschera di bit ottenuta da lookup_classname ()
Original: the bitmask obtained from lookup_classname() The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica] Valore di ritorno
true se
c
è classificato da f
, false altrimenti.Original:
true if
c
is classified by f
, false otherwise.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
#include <iostream> #include <string> #include <regex> int main() { std::regex_traits<char> t; std::string str_alnum = "alnum"; auto a = t.lookup_classname(str_alnum.begin(), str_alnum.end()); std::string str_w = "w"; // [:w:] is [:alnum:] plus '_' auto w = t.lookup_classname(str_w.begin(), str_w.end()); std::cout << std::boolalpha << t.isctype('A', w) << ' ' << t.isctype('A', a) << '\n' << t.isctype('_', w) << ' ' << t.isctype('_', a) << '\n' << t.isctype(' ', w) << ' ' << t.isctype(' ', a) << '\n'; }
Output:
true true true false false false
[modifica] Vedi anche
ottiene una classe di caratteri per nome Original: gets a character class by name The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
[virtuale] |
classifica un carattere o una sequenza di caratteri Original: classifies a character or a character sequence 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 of std::ctype membro)
|