So, in the c++ documentation in the header there is a nice function that lets you sort vectors. I have a class Person
. I have a vector of pointers to objects of that class (vector<Person*>
) and I want to compare the people by different parameters, for example age, length of name and so on.
I already have functions which return the needed variables but I am not sure how to do that. Here is a link to the sort vector function in the c++ reference http://www.cplusplus.com/reference/algorithm/sort/