std::collate (3) - Linux Manuals
std::collate: std::collate
NAME
Synopsis
Defined in header <locale>
template< class CharT >
class collate;
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.
std-collate-inheritance.svg
Inheritance diagram
Two standalone (locale-independent) specializations are provided by the standard library:
Defined in header <locale>
std::collate<char> implements lexicographical ordering of byte strings
std::collate<wchar_t> implements lexicographical ordering of wide strings
In addition, every locale object constructed in a C++ program implements its own (locale-specific) versions of these specializations.
Member types
Member type Definition
char_type CharT
string_type std::basic_string<CharT>
Member functions
constructor (public member function)
destructor (protected member function)
compare (public member function)
transform (public member function)
hash (public member function)
Member objects
static std::locale::id id (public member object)
Protected member functions
do_compare compares two strings using this facet's collation rules
[virtual]
do_transform transforms a string so that collation can be replaced by comparison
[virtual]
do_hash generates an integer hash value using this facet's collation rules
[virtual]
Example
// Run this code
Output:
See also