Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::ptr_vector::sort with c++11 lambdas
From: qplace (admin_at_[hidden])
Date: 2011-11-11 09:30:35


Thorsten Ottosen <thorsten.ottosen <at> dezide.com> writes:

>
>
> 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
>
The first error is:
1>c:\libraries\boost\boost_1_47_0\boost\utility\result_of.hpp(79): error
C2903: 'result' : symbol is neither a class template nor a function template

changing to void* results in the same error.

Test project is this one:

#include <boost/noncopyable.hpp>
#include <boost/ptr_container/ptr_vector.hpp>

class A : public boost::noncopyable
{
public:
        A() {}
};

int _tmain(int argc, _TCHAR* argv[])
{
        boost::ptr_vector<A> lst;
// lst.sort([&] (const A& v1, const A& v2) ->bool {return false;});
        lst.sort([] (const A* v1, const A* v2) ->bool {return false;});
        return 0;
}


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