名前空間
変種
操作

std::collate::transform, std::collate::do_transform

提供: cppreference.com
< cpp‎ | locale‎ | collate

 
 
ローカライゼーションライブラリ
ロケールおよびファセット
Original:
Locales and facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale
文字分類
Original:
Character classification
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
変換
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ファセットカテゴリの基底クラスです
Original:
Facet category base classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ファセットカテゴリ
Original:
Facet categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ロケール固有のファセット
Original:
Locale-specific facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
コー​​ド変換ファセット
Original:
Code conversion facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
codecvt_utf8(C++11)
codecvt_utf16(C++11)
Cロケール
Original:
C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
std::collate
メンバ関数
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.
collate::collate
collate::~collate
collate::compare
collate::do_compare
collate::transform
collate::do_transform
collate::hash
collate::do_hash
 
Defined in header <locale>
public:
string_type transform( const CharT* low, const CharT* high ) const;
(1)
protected:
string_type do_transform( const CharT* low, const CharT* high ) const;
(2)
1)
パブリックメンバ関数、最派生クラスのプロテクト仮想メンバ関数を呼び出しdo_transform.
Original:
public member function, calls the protected virtual member function do_transform of the most derived class.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
文字シーケンス[low, high)が別の文字列にoperator<を呼び出した結果と辞書式に比較する文字列(文字列の場合transform()付きなど)に変換し、同じ2つの文字列にdo_compare()を呼び出した場合と同じ結果を生成します.
Original:
Converts the character sequence [low, high) to a string that, compared lexicographically (e.g. with operator< for strings) with the result of calling transform() on another string, produces the same result as calling do_compare() on the same two strings.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

low -
変換するシーケンス内の最初の文字へのポインタ
Original:
pointer to the first character in the sequence to transform
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
high -
変換するシーケンスの終了ポインタ過去1
Original:
one past the end pointer for the sequence to transform
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

文字列が変換された文字列の辞書式の比較は原稿の照合の代わりに使用することができるように変換する。 "C"ロケールでは、返される文字列は、[low, high)の正確なコピーです。他のロケールでは、返される文字列の内容は実装定義であり、サイズがかなり長くなることがあります.
Original:
The string transformed so that lexicographic comparison of the transformed strings may be used instead of collating of the originals. In the "C" locale, the returned string is the exact copy of [low, high). In other locales, the contents of the returned string are implementation-defined, and the size may be considerably longer.
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 <> :: transform_primaryに知られています.
Original:
In addition to the the use in collation, the implementation-specific format of the transformed string is known to のstd :: regex_traits <> :: transform_primary, which is able to extract the equivalence class information.
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 <iomanip>
#include <locale>
 
int main()
{
    std::locale::global(std::locale("sv_SE.utf8"));
    auto& f = std::use_facet<std::collate<wchar_t>>(std::locale());
 
    std::wstring in1 = L"\u00e4ngel";
    std::wstring in2 = L"\u00e5r";
 
    std::wstring out1 = f.transform(&in1[0], &in1[0] + in1.size());
    std::wstring out2 = f.transform(&in2[0], &in2[0] + in2.size());
 
    std::wcout << "In the Swedish locale: ";
    if(out1 < out2)
         std::wcout << in1 << " before " << in2 << '\n';
    else
         std::wcout << in2 << " before " << in1 << '\n';
 
    std::wcout << "In lexicographic comparison: ";
    if(in1 < in2)
         std::wcout << in1 << " before " << in2 << '\n';
    else
         std::wcout << in2 << " before " << in1 << '\n';
 
}

Output:

In the Swedish locale: år before ängel
In lexicographic comparison: ängel before år

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

strcmp関数はstrcoll関数と同じ結果を生成するように文字列を変換します
Original:
transform a string so that strcmp would produce the same result as strcoll
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(機能) [edit]
wcscmp関数は、wcscoll関数と同じ結果を生成するように、ワイド文字列を変換します
Original:
transform a wide string so that wcscmp would produce the same result as wcscoll
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(機能) [edit]