Compartilhar via


collate Class

A template class that describes an object that can serve as a locale facet to control the ordering and grouping of characters within a string, comparisons between them and the hashing of strings.

template <class CharType >
   class collate : public locale::facet;

Parameters

  • CharType
    The type used within a program to encode characters.

Remarks

As with any locale facet, the static object ID has an initial stored value of zero. The first attempt to access its stored value stores a unique positive value in id. In some languages, characters are grouped and treated as a single character, and in others, individual characters are treated as if they were two characters. The collating services provided by the collate class provide the way to sort these cases.

Constructors

collate

The constructor for objects of class collate that serves as a locale facet to handle string sorting conventions.

Typedefs

char_type

A type that describes a character of type CharType.

string_type

A type that describes a string of type basic_string containing characters of type CharType.

Member Functions

compare

Compares two character sequences according to their facet-specific rules for equality or inequality.

do_compare

A virtual function called to compare two character sequences according to their facet-specific rules for equality or inequality.

do_hash

A virtual function called to determine the hash value of sequences according to their facet-specific rules.

do_transform

A virtual function called to convert a character sequence from a locale to a string that may be used in lexicographical comparisons with other character sequences similarly converted from the same locale.

hash

Determines the hash value of sequence according to their facet-specific rules.

transform

Converts a character sequence from a locale to a string that may be used in lexicographical comparisons with other character sequences similarly converted from the same locale.

Requirements

Header: <locale>

Namespace: std

See Also

Reference

<locale>

Thread Safety in the C++ Standard Library