名前空間
変種
操作

std::regex_traits::isctype

提供: cppreference.com
< cpp‎ | regex‎ | regex traits

 
 
正規表現ライブラリ
クラス
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_regex(C++11)
sub_match(C++11)
match_results(C++11)
アルゴリズム
Original:
Algorithms
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_match(C++11)
regex_search(C++11)
regex_replace(C++11)
イテレータ
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_iterator(C++11)
regex_token_iterator(C++11)
例外
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_error(C++11)
形質
Original:
Traits
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_traits(C++11)
定数
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
syntax_option_type(C++11)
match_flag_type(C++11)
error_type(C++11)
 
 
bool isctype( CharT c, char_class_type f ) const;
文字cは、順番に、fによって返された値であり、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.
std::regex_traitsの標準ライブラリの専門分野で提供されるこの関数のバージョンでは、最初のfを呼び出すことによって吹き込まれたロケールで文字を分類しようとした後、実装定義の方法でタイプmのいくつかの一時的な値std::ctype_base::maskstd::use_facet<std::ctype<CharT>>(getloc()).is(m, c)に変換します。それはtrueを返した場合、trueisctype()によって返されます。それ以外の場合は、c'_'に等しく、ビットマスクfは、ケース[:w:]が返される文字クラスtrue、に対応しているかどうかチェックします。それ以外の場合は、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.
注:公開された標準は、すべてのケースで'_'に対してtrueを返すには、この機能を必要とする、間違って言葉で表現されています。これは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.

目次

[編集] パラメータ

c -
分類するための文字
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 -
ビットマスクは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.

[編集] 値を返します

truecfによって分類されている場合、falseその他のとき.
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.

[編集]

#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

[編集] も参照してください

名前で文字クラスを取得します
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.

(パブリックメンバ関数)
[仮想]
文字または文字シーケンスを分類しています
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.

(仮想protectedメンバ関数of std::ctype) [edit]