Boost logo

Boost Users :

Subject: Re: [Boost-users] Compilation errors when trying to use range adaptors with C++11 lambdas
From: Evan Driscoll (driscoll_at_[hidden])
Date: 2012-06-20 14:11:55


On 06/20/2012 09:04 AM, boost-users-request_at_[hidden] wrote:
> 2012/6/20 Evan Driscoll<driscoll_at_[hidden]>:
>> When trying to compile the following:
>>
>> std::vector<int> v;
>> v | boost::adaptors::transformed([] (int x) { return x; });
>>
>> I get a bunch of compile errors. If I replace the lambda with a function
>> defined normally, it works.
>
> You must use
> #define BOOST_RESULT_OF_USE_DECLTYPE
>
> C++11 lambda can't apply non decltype-base result_of.

Thanks a lot; worked like a charm. Of course, in the interim I figured
out that the function will be rather more complicated than I thought so
I'm happier with it defined normally, but that'll be good to file away
for future reference. :-)

Evan


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