Subject: Re: [boost] [utility][thread] result_of - erroneous result type from a C++11 lambda
From: Klaim - JoÃ«l Lamotte (mjklaim_at_[hidden])
Date: 2013-06-17 14:27:13
On Mon, Jun 17, 2013 at 8:06 PM, Daniel Walker <daniel.j.walker_at_[hidden]>wrote:
> If I'm not mistaken, it looks like you are using the TR1 protocol with
> nullary functions. See the bullet point on nullary functions in the
> TR1 cannot deduce the return type of nullary function objects. You
> probably either want to use std::result_of or boost::result_of with
> BOOST_RESULT_OF_USE_DECLTYPE defined. If you really must use TR1 there are
> workarounds for the nullary function issue discussed at the same bullet
> point at the link above, but these workarounds may not be applicable in
> your situation. In C++11, I would not recommend using TR1 unless you need
> it for backwards compatibility/portability to C++03, in which case you
> can't deduce return types for nullary function objects.
In my own VS2012 code I use decltype exclusively.
But that do not fix the problem for boost libraries themselves:
Boost.Thread (future, async) apparently uses boost::result_of which makes
the two first example I provide go wrong and
makes both async and .then unusable.
My understanding was that indeed these libraries would automatically use
decltype() in the implementation if available, not tr1::result_of or
Is automatically BOOST_RESULT_OF_USE_DECLTYPE defined for VS2012? If not
isn't it a bug? decltype is available whatever the compilation flags you
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk