class template
<locale>
std::collate
template <class charT> class collate;
Facet to compare and hash strings
The collate standard facet provides functions to compare and assist in comparing strings in a locale-specific manner.
The collate class template has a protected destructor: Programs shall only construct objects of derived classes, or use those installed in locale objects (through use_facet).
All standard locale objects support at least the following facet instantiations of the collate class template as part of the collate category:
facets in locale objects | description |
collate<char> | narrow characters |
collate<wchar_t> | wide characters |
Template parameters
- charT
- Character type.
Aliased as member char_type.
Member types
member type | definition | description |
char_type | The template parameter (charT) | Character type |
string_type | basic_string<charT> | String type corresponding to the character type |
Member constants
The class contains a public static constant of type locale::id that uniquely identifies facets with collate semantics.
Public member functions
- (constructor)
- collate constructor (public member function)
- compare
- Compare character sequences (public member function)
- transform
- Transform character sequence (public member function)
- hash
- Get hash value (public member function)
Virtual protected member functions
The class defines the virtual protected members which implement the behavior by default of their respective member functions:
- do_compare
- Compare character sequences [virtual] (protected virtual member function)
- do_transform
- Transform character sequence [virtual] (protected virtual member function)
- do_hash
- Get has value [virtual] (protected virtual member function)
Along with the class destructor:
- (destructor)
- collate destructor (protected member function)
Specializations
At least the following specializations of this template are provided in all library implementations:
specialization |
collate<char> |
collate<wchar_t> |