Make comparator with &
instead of *
class AccountOrder
{
public:
bool operator()(const Client &a, const Client &b) const
{
return a.getAccountBalance() > b.getAccountBalance();
};
};
The signature of the comparison function should be equivalent to the following:
bool cmp(const Type1 &a, const Type2 &b);
The signature does not need to have const &, but the function must not modify the objects passed to it.