I have a class pointer vector std::vector<Square*> listSquares . I want to sort it with one of the class attributes as a key. This is what I do
bool compById(Square* a, Square* b) { return a->getId() < b->getId(); } std::sort(listSquares.begin(), listSquares.end(), compById)
but the compiler says: error: there is no suitable function to call sorting (std :: vector :: iterator, std :: vector :: iterator, & unresolved overloaded function type>) '
what am i doing wrong here?
qutab
source share