Это, вероятно, лучше всего указано в качестве примера. У меня есть два вектора/списки:
People = {Anne, Bob, Charlie, Douglas}
Ages = {23, 28, 25, 21}
Я хочу сортировать Люди по их возрасту, используя что-то вроде sort(People.begin(), People.end(), CustomComparator)
, но я не знаю, как написать CustomComparator
для просмотра возрастов, а не для людей.