名前空間
変種
操作

std::regex_traits::transform_primary

提供: 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)
 
std::regex_traits
メンバー関数
Original:
Member Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_traits::regex_traits
regex_traits::length
regex_traits::translate
regex_traits::translate_nocase
regex_traits::transform
regex_traits::transform_primary
regex_traits::lookup_collatename
regex_traits::lookup_classname
regex_traits::isctype
regex_traits::value
regex_traits::imbue
regex_traits::getloc
 
template< class ForwardIt >
string_type transform_primary( ForwardIt first, ForwardIt last) const
主ソートキーが[first, last)を持つ別の主ソートキー未満を比較した場合、最初の並べ替えキーを生成された文字シーケンスが前に来るoperator<、そのような文字シーケンスのプライマリ(大文字小文字は無視して、発音記号、変形など)ソートキーを取得現在吹き込まロケールのプライマリ照合順序で、第二ソートキーを生成された文字シーケンス.
Original:
Obtains the primary (ignoring case, diacritics, variant, etc) sort key for the character sequence [first, last), such that if a primary sort key compares less than another primary sort key with operator<, then the character sequence that produced the first sort key comes before the character sequence that produced the second sort key, in the currently imbued locale's primary collation order.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
正規表現ライブラリは等価クラスに対する文字に一致するように、この特性を使用しています。 [[=a=]]c1traits.transform_primary(c1)からtraits.transform_primary("a")に対して真である)と等価である場合、例えば、正規表現は文字c1"AÀÁÂÃÄÅaàáâãäå"に相当します。同値クラスは複数文字である可能性があるため、このようなtransform_primary()[[=ll=]]として、文字シーケンスを引数にとることに注意してください.
Original:
The regex library uses this trait to match characters against equivalence classes. For example, the regex [[=a=]] is equivalent to the character c1 if traits.transform_primary(c1) is equivalent to traits.transform_primary("a") (which is true for any c1 from "AÀÁÂÃÄÅaàáâãäå"). Note that transform_primary() takes a character sequence argument because equivalence classes may be multicharacter, such as [[=ll=]].
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
照合キーからの変換はロケール固有であり、ユーザがstd::localeファセットを置き換えた場合、その変換は、もはやに知られていない次等価キーにstd::collate::transform()によって返されたのでstd::collateの面で主ソートキーを定義するポータブルな方法はありません標準ライブラリのstd::regex_traitsstd::regex_traitsの標準ライブラリの専門分野は、現在吹き込まれたロケールのstd::collateファセットがユーザーによって置換されない限り、空の文字列を返し、まだシステム提供std::collateファセットに一致します)、その場合にはstd::collate_byname<charT>::transform(first, last)が実行され、それが生成するソート·キーがあるロケール固有の変換を使用して予想される主ソートキーに変換.
Original:
There is no portable way to define primary sort key in terms of std::locale since the conversion from the collation key returned by std::collate::transform() to the primary equivalence key is locale-specific, and if the user replaces the std::collate facet, that conversion is no longer known to the standard library's std::regex_traits. Standard library specializations of std::regex_traits return an empty string unless the std::collate facet of the currently-imbued locale was not replaced by the user, and still matches the system-supplied std::collate facet), in which case std::collate_byname<charT>::transform(first, last) is executed and the sort key it produces is converted to the expected primary sort key using a locale-specific conversion.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] パラメータ

first, last -
比較する文字のシーケンスを決定するイテレータのペア
Original:
a pair of iterators which determines the sequence of characters to compare
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Type requirements
-
ForwardIt must meet the requirements of ForwardIterator.

[編集] 値を返します

場合、バリアント、発音記号などを無視して現在吹き込まロケール内の文字シーケンスのプライマリソートキー[first, last)
Original:
The primary sort key for the character sequence [first, last) in the currently imbued locale, ignoring case, variant, diacritics, etc.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

transform_primary()を介して動作する正規表現の機能の例を示します
Original:
Demonstrates the regex feature that works through transform_primary()
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 <regex>
 
int main()
{
    std::locale::global(std::locale("en_US.UTF-8"));
    std::wstring str = L"AÀÁÂÃÄÅaàáâãäå";
    std::wregex re(L"[[=a=]]*", std::regex::basic);
    std::cout << std::boolalpha << std::regex_match(str, re) << '\n';
}

Output:

true