Boost logo

Boost Users :

Subject: [Boost-users] boost::ptr_vector::sort with c++11 lambdas
From: qplace (admin_at_[hidden])
Date: 2011-11-11 07:52:53


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?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net