list::sort
requires a predicate function-object.
You can try:
std::list<person> people;
// Add some people...
people.sort([](const person &left, const person &right)
{
return left.name < right.name;
});
See also:
Sorting a list of a custom type
1
solved C++ Own comparison in std::list