Standard C++ Library Reference ISO/IEC (VERSION3)
int compare(const Elem *first1, const Elem *last1,
const Elem *first2, const Elem *last2) const;
string_type transform(const Elem *first,
const Elem *last) const;
long hash(const Elem *first, const Elem *last) const;
static locale::id id;
protected:
~collate();
virtual int
do_compare(const Elem *first1, const Elem *last1,
const Elem *first2, const Elem *last2) const;
virtual string_type do_transform(const Elem *first,
const Elem *last) const;
virtual long do_hash(const Elem *first,
const Elem *last) const;
};
The template class describes an object that can serve as a locale facet, to control comparisons of sequences of type
Elem.
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.
collate::char_type
typedef Elem char_type;
The type is a synonym for the template parameter Elem.
collate::collate
explicit collate(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
collate::compare
int compare(const Elem *first1, const Elem *last1,
const Elem *first2, const Elem *last2) const;
The member function returns do_compare(first1, last1, first2, last2).
collate::do_compare
virtual int do_compare(const Elem *first1, const Elem *last1,
const Elem *first2, const Elem *last2) const;
The protected virtual member function compares the sequence at [first1, last1) with the sequence at
[first2, last2). It compares values by applying operator< between pairs of corresponding elements of type
Elem. The first sequence compares less if it has the smaller element in the earliest unequal pair in the sequences, or if no
unequal pairs exist but the first sequence is shorter.
If the first sequence compares less than the second sequence, the function returns -1. If the second sequence compares
less, the function returns +1. Otherwise, the function returns zero.