std::regex_traits::isctype
Aus 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; |
||
Bestimmt, ob der Charakter der
c
Zeichenklasse durch f
, welches wiederum ein durch lookup_classname()
zurückgegeben identifiziert gehört .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.
Die Version dieser Funktion in den Standard-Bibliothek Spezialisierungen std::regex_traits vorgesehen, wandelt zunächst
f
bis zu einem gewissen temporären Wert m
vom Typ std::ctype_base::mask in der Implementierung definiert, dann versucht, die Zeichen in der durchdrungen locale klassifizieren indem std::use_facet<std::ctype<CharT>>(getloc()).is(m, c). Wenn das zurückgegebene true wird true durch isctype()
zurückgegeben. Andernfalls wird geprüft, ob c
gleich '_'
und die Bitmaske f
entspricht der Zeichenklasse [:w:]
, in welchem Fall true zurückgegeben. Andernfalls wird false
zurückgegeben .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.
Hinweis: Die veröffentlichten Standard ist falsch, formuliert erfordern diese Funktion, um zurückzukehren zum
'_'
in allen Fällen wahr. Dies ist 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.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
c | - | der Charakter zu klassifizieren
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 | - | Die Bitmaske aus lookup_classname () erhalten
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. |
[Bearbeiten] Rückgabewert
true wenn
c
wird durch f
eingestuft, false sonst .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.
[Bearbeiten] Beispiel
#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
[Bearbeiten] Siehe auch
bekommt einen Charakter-Klasse mit Namen 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. (öffentliche Elementfunktion) | |
[virtuell] |
stuft ein Zeichen oder eine Zeichenfolge 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. (virtuellen geschützten Member-Funktion of std::ctype )
|