std::locale::operator()
Min standard notice:
Compares two string arguments s1 and s2 according to the lexicographic comparison rules defined by this locale’s std::collate
# Declarations
template< class CharT, class Traits, class Alloc >
bool operator()( const std::basic_string<CharT,Traits,Alloc>& s1,
const std::basic_string<CharT,Traits,Alloc>& s2 ) const;
# Parameters
s1: the first string to compares2: the second string to compare
# Return value
true if s1 is lexicographically less than s2, false otherwise.
# Example
#include <algorithm>
#include <cassert>
#include <locale>
#include <string>
#include <vector>
int main()
{
std::vector<std::wstring> v = {L"жил", L"был", L"пёс"};
std::sort(v.begin(), v.end(), std::locale("ru_RU.UTF8"));
assert(v[0] == L"был");
assert(v[1] == L"жил");
assert(v[2] == L"пёс");
}