How to sort by size
Hi people! I would love any help on this one:
I have a list of lists list<list<int>*> and I need to sort it by the size of the inner list. I only need to know how to declare a Compare function (I saw this kind of function in references, but I donīt know how to declare it).
So, I coulde use: myList.sort( compare_function );
I think it the compare function should look like this.
That should sort in increasing order according to size.
bool Compare(const list<int> &l1, const list<int> &l2)
return l1.size() < l2.size();
Actually, after a lot of study, I had discover that the compare function returns an int, I think this is because an int can show three results: less, equal and greater.
But thanks for the reply :)