std::collate
提供:cppreference.com
|
|
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. |
| Defined in header <locale>
|
||
| template< class CharT > class collate; |
||
クラスstd::collateカプセル化して、ロケール固有の照合(比較)と文字列のハッシュ。このファセットはstd::basic_regexによって使用され、直接文字列の比較述語を期待するすべての標準アルゴリズムに、std::locale::operator()により、適用することができます.
Original:
Class std::collate encapsulates locale-specific collation (comparison) and hashing of strings. This facet is used by std::basic_regex and can be applied, by means of std::locale::operator(), directly to all standard algorithms that expect a string comparison predicate.
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.
2つの専門分野は、標準ライブラリによって提供されており、C + +プログラムで作成されたすべてのロケール·オブジェクトによって実装されます
Original:
Two specializations are provided by the standard library and are implemented by all locale objects created in a C++ program:
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.
| Defined in header
<locale> | |
| std::collate<char> | バイト文字列の順序を辞書式が実装されています
Original: implements lexicographical ordering of byte strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| std::collate<wchar_t> | 道具はワイド文字列の辞書順
Original: implements lexicographical ordering of wide strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
目次 |
[編集] メンバータイプ
| メンバー·タイプ
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
char_type
|
charT
|
string_type
|
std::basic_string<charT>
|
[編集] メンバ関数
| 新しい照合ファセットを構築します Original: constructs a new collate facet The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
| 照合ファセットを破棄します Original: destructs a collate facet The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (メンバー関数を保護しました) | |
do_compareを呼び出します Original: invokes do_compare The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
do_transformを呼び出します Original: invokes do_transform The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
do_hashを呼び出します Original: invokes do_hash The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
[編集] メンバーオブジェクト
| static std::locale::id id |
idはロケールの Original: id of the locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバオブジェクト) |
[編集] メンバ関数を保護しました
| [仮想] |
このファセットの照合ルールを使用して2つの文字列を比較します Original: compares two strings using this facet's collation rules The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (仮想protectedメンバ関数) |
| [仮想] |
その照合は比較に置き換えることができるように文字列を変換します Original: transforms a string so that collation can be replaced by comparison The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (仮想protectedメンバ関数) |
| [仮想] |
このファセットの照合ルールを使用して整数のハッシュ値を生成します Original: generates an integer hash value using this facet's collation rules The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (仮想protectedメンバ関数) |
[編集] 例
#include <locale> #include <iostream> #include <string> #include <vector> #include <algorithm> int main() { std::wcout.imbue(std::locale("")); std::vector<std::wstring> v = {L"ar", L"zebra", L"\u00f6grupp", L"Zebra", L"\u00e4ngel", L"\u00e5r", L"f\u00f6rnamn"}; std::wcout << "Default locale collation order: "; std::sort(v.begin(), v.end()); for(auto s : v) std::wcout << s << ' '; std::wcout << '\n'; std::wcout << "English locale collation order: "; std::sort(v.begin(), v.end(), std::locale("en_US.UTF-8")); for(auto s : v) std::wcout << s << ' '; std::wcout << '\n'; std::wcout << "Swedish locale collation order: "; std::sort(v.begin(), v.end(), std::locale("sv_SE.UTF-8")); for(auto s : v) std::wcout << s << ' '; std::wcout << '\n'; }
Output:
Default locale collation order: Zebra ar förnamn zebra ängel år ögrupp English locale collation order: ängel ar år förnamn ögrupp zebra Zebra Swedish locale collation order: ar förnamn zebra Zebra år ängel ögrupp
[編集] も参照してください
| lexicographically compares two strings using this locale's collate facet (パブリックメンバ関数of std::locale)
| |
| 名前のロケール用の照合ファセットを作成します Original: creates a collate facet for the named locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) | |
