
I want to sort a vector of Edges according to their remaining estimated distance to the finish point (an own implementation of a graph algorithm). How do I sort this vector with edges: // Returns the cost between start and finish, given a graph int CostEstimate( const Graph& aGraph, const Vertex& start, const Vertex& finish) ... // Member function of a graph std::vector< Edge > v = ...; // Sort them according to the cost std::sort( v.begin(), v.end(), boost::lambda::bind( CostEstimate( (*this), boost::lambda::bind( &Edge::otherSide, &start, boost::lambda::_1), finish)) < boost::lambda::bind( CostEstimate( (*this), boost::lambda::bind( &Edge::otherSide, &start, boost::lambda::_2), finish))); where otherSide is a const function of the class Edge which returns a "const Vertex&" Compiling this results in an error: error: invalid initialization of reference of type ‘const Vertex&’ from expression of type ‘const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<3, boost::lambda::function_action<3, boost::lambda::detail::unspecified> >, boost::tuples::tuple<const Vertex& (Edge::* const)(const Vertex&)const, const Vertex* const, const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >’ TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web: www.askesis.nl