std::locale::operator() (3) - Linux Manuals
std::locale::operator(): std::locale::operator()
NAME
std::locale::operator() - std::locale::operator()
Synopsis
template< class CharT, class Traits, class Alloc >
bool operator()( const basic_string<CharT,Traits,Alloc>& s1,
const basic_string<CharT,Traits,Alloc>& s2) const;
Compares two string arguments s1 and s2 according to the lexicographic comparison rules defined by this locale's std::collate<charT> facet. This operator allows any locale object that has a collate facet to be used as a binary predicate in the standard algorithms (such as std::sort) and ordered containers (such as std::set)
Parameters
s1 - the first string to compare
s2 - the second string to compare
Return value
true if s1 is lexicographically less than s2, false otherwise.
Possible implementation
Example
A vector of strings can be sorted according to a non-default locale by using the locale object as comparator:
// Run this code
See also
collate (class template)