I am trying to sort a vector below using boost::phoenix library. The class Foo has a member function 'int getvalue()'. The purpose is to sort the vector using the value returned by 'getvalue()'. But something is missing. I get compiler error as '::second is not a class or namespace'
std::vector<std::pair<int, Foo> > fooVec;
boost::phoenix::sort ( boost::phoenix::bind( &std::pair<int, Foo>::second::getvalue(), boost::phoenix::arg_names::arg1) (*fooVec.begin() ), std::less<int>() );
Can anybody please explain this. What changes do I need to make this work?
Thanks.
PS: I know I could have used function object/lambda or soemthing similar but I wanted to try out boost::phoenix.