std::regex_traits::isctype
De 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; |
||
Détermine si le caractère
c
appartient à la classe de caractères identifiés par f
, qui, à son tour, est une valeur renvoyée par 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 version de cette fonction fournie dans les spécialités de la bibliothèque standard de std::regex_traits, convertit d'abord
f
une certaine m
valeur temporaire de std::ctype_base::mask type défini par l'implémentation manière, tente alors de classer le caractère de la localisation en imprégnée en appelant std::use_facet<std::ctype<CharT>>(getloc()).is(m, c). Si ce retour true, true est retourné par isctype()
. Sinon, vérifie si c
égale '_'
et le f
masque correspond à la classe de caractères [:w:]
, dans lequel true affaire est renvoyée. Sinon, false
est retourné .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.
Remarque: la norme publiée est formulée de manière incorrecte, nécessitant cette fonction pour retourner vrai pour
'_'
dans tous les cas. C'est 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.
Sommaire |
[modifier] Paramètres
c | - | le caractère à classer
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 | - | le masque obtenu à partir 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. |
[modifier] Retourne la valeur
true si
c
est classé par f
, false autrement .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.
[modifier] Exemple
#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'; }
Résultat :
true true true false false false
[modifier] Voir aussi
obtient une classe de caractères par nom 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. (fonction membre publique) | |
[ virtuel ]Original: virtual The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
classer un caractère ou une séquence de caractères 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. (fonction membre virtuelle protégée de std::ctype )
|