In versions C ++ to C ++ 0x, classes declared inside functions cannot be displayed in template parameters. Your call to sort implicitly launches it with a template parameter set to InlinePredicate , which is illegal.
You might want to use either C ++ 0x (with GCC, pass --std=c++0x ; in C ++ 0x this code will work as it is, or you can use anonymous functions) or boost::lambda . With boost::lambda it would look like this:
using namespace boost::lambda; sort(a.begin(), a.end(), _1 < _2);
bdonlan
source share