11 Nov
2011
11 Nov
'11
1:45 p.m.
Den 11-11-2011 13:52, qplace skrev:
I am trying to figure out if c++11 lambda can be used instead of the straight preducates.
say, I have class A : public boost::noncopyable { ... }
and
boost::ptr_vector<A> lst;
I'd like to use something like:
lst.sort([&] (const A& v1, const A& v2) ->bool {return v1< v2;});
Tutorial for ptr_vector says that predicates are wrapped in indirect_fun. May be this is the reason the sort fails to compile?
Could be. What does the error message say? I'm thinking that the lambda function is not properly converted to a pointer to a function. An escape route may be to use std::sort() with a lambda taking two void*. -Thorsten