Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] Using lambda with unique_future
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-03-05 15:32:31


AMDG

On 03/05/2013 12:16 PM, Christian Henning wrote:
> I'm toying around with futures and I'm stumbling with the Visual
> Studio 2010 compiler.
>
> The following doesn't compile:
>
> boost::unique_future<int> the_answer = boost::async( [] () ->int {
> return 42; } );
>
> the error is:
>
> <snip>
>
> clang works just fine:
> http://liveworkspace.org/code/1gOYwa$2
>
> Is this a compiler error or am I doing something wrong?
>

I'd guess that the problem is that boost::result_of
doesn't work for C++11 lambdas. clang works because
decltype-based result_of is enabled for clang.

In Christ,
Steven Watanabe


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