Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::ptr_vector::sort with c++11 lambdas
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-11-11 10:11:35


Den 11-11-2011 15:30, qplace skrev:
> 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.

I'm saying use std::sort() with void* arguments.

> // lst.sort([&] (const A& v1, const A& v2) ->bool {return false;});
> lst.sort([] (const A* v1, const A* v2) ->bool {return false;});

The first one is the correct one. But I think the problem is with
indirect_fun, or the code surrounding it. Does this work:

auto x = <lambda>;

boost::indirect_fun<decltype(x)> fun(x);

?

-Thorsten


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