class template


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 objectsdescription
collate<char>narrow characters
collate<wchar_t>wide characters

Template parameters

Character type.
Aliased as member char_type.

Member types

member typedefinitiondescription
char_typeThe template parameter (charT)Character type
string_typebasic_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

Virtual protected member functions

The class defines the virtual protected members which implement the behavior by default of their respective member functions:

Along with the class destructor:


At least the following specializations of this template are provided in all library implementations: