I am trying to sort a vector of custom struct in C++
struct Book{
public:int H,W,V,i;
};
with a simple functor
class CompareHeight
{
public:
int operator() (Book lhs,Book rhs)
{
return lhs.H-rhs.H;
}
};
when trying :
vector<Book> books(X);
.....
sort(books.begin(),books.end(), CompareHeight());
it gives me exception "invalid operator <"
What is the meaning of this error?
Thanks