How do I define the use of list::sort() when the list holds pointers? For
example,
#include <list>
class foo {
public:
foo(int i): i(i) {};
~foo();
private:
int i;
};
void main() {
foo *f = new foo(3);
foo *g = new foo(2);
list< foo* > l;
l.push_back(f);
l.push_back(g);
l.sort(); // I want this to sort based on foo::i
}
Thanks,
Tim Partridge