You can use the functor:
#include <vector>
#include <algorithm>
class StudentAliasComparator
{
public:
bool operator()(const Student* left, const Student* right) const
{
return left->studentAlias() < right->studentAlias();
}
};
void SortVectorOfStudentByAlias(std::vector<Student*>& students)
{
std::sort(students.begin(), students.end(), StudentAliasComparator());
}
boost, langage ( ++ 0x). ++ 0x - ( , ++, ++ 0x ):
void SortVectorOfStudentByAlias(std::vector<Student*>& students)
{
std::sort(students.begin(), students.end(),
[](const Student* l, const Student* r) {
return l->studentAlias() < r->studentAlias(); })
}