std::regex_traits::isctype
Da cppreference.com
< cpp | regex | regex traits
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
bool isctype( CharT c, char_class_type f )const; | ||
Determina se a
c
personagem pertence à classe de caracteres identificados pelo f
, o qual, por sua vez, é um valor retornado 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.
A versão desta função fornecida nas especializações de biblioteca padrão de std::regex_traits, primeiro converte
f
a alguns m
valor temporário de std::ctype_base::mask tipo de aplicação definida maneira, em seguida, tenta classificar o personagem na localidade imbuído chamando std::use_facet<std::ctype<CharT>>(getloc()).is(m, c). Se isso voltou true, true é devolvido pelo isctype()
. Caso contrário, verifica se c
igual '_'
eo f
bitmask corresponde ao [:w:]
classe de personagem, em que true caso é devolvido. Caso contrário, é retornado 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: a norma publicada é colocada incorretamente, exigindo esta função retornar verdadeiro para
'_'
em todos os casos. Este é 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.
Índice |
[editar]Parâmetros
c | - | o caráter de classificar 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 | - | a máscara de bits obtido 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 se
c
é classificado por f
, false outra forma.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]Exemplo
#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';}
Saída:
true true true false false false
[editar]Veja também
recebe uma classe de personagem pelo 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. (função pública membro) | |
[virtual] | classifica um personagem ou uma sequência 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. (virtual protegido of std::ctype função de membro) |