< cpp‎ | locale
Revision as of 20:28, 2 November 2012 by P12bot (Talk | contribs)

Template:ddcl list begin <tr class="t-dsc-header">

Defined in header <locale>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td class="t-dcl-nopad">
template< class CharT >
class collate_byname : public std::collate<CharT>;

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

std::collate_byname is a std::collate facet which encapsulates locale-specific collation (comparison) and hashing of strings. Just like std::collate, it can be imbued in std::regex and applied, by means of std::locale::operator(), directly to all standard algorithms that expect a string comparison predicate.

Two specializations are provided by the standard library

Defined in header <locale>
std::collate_byname<char> locale-specific collation of multibyte strings
std::collate_byname<wchar_t> locale-specific collation of wide strings


Member functions

constructs a new collate_byname facet
(public member function)
destructs a collate_byname facet
(protected member function)

Inherited from std::collate

Member types

Member type Definition
char_type charT
string_type std::basic_string<charT>

Member functions

invokes do_compare
(public member function of std::collate) [edit]
invokes do_transform
(public member function of std::collate) [edit]
invokes do_hash
(public member function of std::collate) [edit]

Protected member functions

compares two strings using this facet's collation rules
(virtual protected member function of std::collate) [edit]
transforms a string so that collation can be replaced by comparison
(virtual protected member function of std::collate) [edit]
generates an integer hash value using this facet's collation rules
(virtual protected member function of std::collate) [edit]


Collation order is the dictionary order: the position of the letter in the national alphabet (its equivalence class) has higher priority than its case or variant. Within an equivalence class, lowercase characters collate before their uppercase equivalents and locale-specific order may apply to the characters with diacritics. In some locales, groups of characters compare as single collation units. For example, "ch" in Czech follows "h" and precedes "i", and "dzs" in Hungarian follows "dz" and precedes "g".


See also

Template:cpp/locale/dcl list collateTemplate:cpp/string/byte/dcl list strcollTemplate:cpp/string/wide/dcl list wcscollTemplate:cpp/locale/locale/dcl list operator()