[locale.operators] (original) (raw)

28 Localization library [localization]

28.3 Locales [locales]

28.3.1 Class locale [locale]

28.3.1.5 Operators [locale.operators]

bool operator==(const locale& other) const;

Returns: trueif both arguments are the same locale, or one is a copy of the other, or each has a name and the names are identical;falseotherwise.

template<class charT, class traits, class Allocator> bool operator()(const basic_string<charT, traits, Allocator>& s1,const basic_string<charT, traits, Allocator>& s2) const;

Effects: Compares two strings according to thecollate<charT>facet.

Returns: use_facet<collate<charT>>(*this).compare(s1.data(), s1.data() + s1.size(), s2.data(), s2.data() + s2.size()) < 0

Remarks: This member operator template (and thereforelocaleitself) meets the requirements for a comparator predicate template argument ([algorithms]) applied to strings.

[Example 1:

A vector of stringsvcan be collated according to collation rules in localelocsimply by ([alg.sort], [vector]):std::sort(v.begin(), v.end(), loc);

— _end example_]