std::regex_traits::isctype
De cppreference.com
< cpp | regex | regex traits
![]() |
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
bool isctype( CharT c, char_class_type f ) const; |
||
Determina si la
c
personaje pertenece a la clase de caracteres identificados por f
, que, a su vez, es un valor devuelto por 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 versión de esta función prevista en la especialización de la biblioteca estándar de std::regex_traits, primero convierte
f
a algunos m
valor temporal del std::ctype_base::mask tipo de aplicación definido por el modo, a continuación, intenta clasificar el carácter en la configuración regional imbuida llamando std::use_facet<std::ctype<CharT>>(getloc()).is(m, c). Si eso regresó true, true es devuelto por isctype()
. De lo contrario, comprueba si es igual a c
'_'
y la f
máscara de bits corresponde a la [:w:]
clase de caracteres, en el que se devuelve true caso. De lo contrario, se devuelve 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 publicada está redactada incorrectamente, lo que requiere esta función para que devuelva true para
'_'
en todos los casos. Esto es 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.
Contenido |
[editar] Parámetros
c | - | el carácter de clasificar
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 máscara de bits obtenida de 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. |
[editar] Valor de retorno
true
c
si se clasifica por f
, false de otra manera .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.
[editar] Ejemplo
Ejecuta este código
#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'; }
Salida:
true true true false false false
[editar] Ver también
recibe una clase de caracteres por nombre 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. (función miembro pública) | |
[virtual] |
clasifica un carácter o una secuencia de caracteres 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. (función miembro virtual protegida de std::ctype )
|