Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range & c++0x Lambdas] Can this be done?
From: Eric Niebler (eric_at_[hidden])
Date: 2012-11-29 01:26:40


On 11/22/2012 11:31 AM, Jeffrey Lee Hellrung, Jr. wrote:
> Maybe this is what you did, so I might not be suggesting something new,
> but... Perhaps boost::result_of could have an extra conditional logic
> branch added to it:
> - If F::result_type exists, return F::result_type;
> - Else:
> - If BOOST_NO_CXX11_DECLTYPE, return F::result< F ( Args... ) >
> - Else, if F::result<> exists, return F::result< F ( Args... ) >
> - Else return decltype( declval<F>() ( declval< Args >()... ) )

C++11 defines exactly what result_of does, as did the TR1 spec before
it. Making boost::result_of do something different would be surprising, IMO.

If you want to use C++11 lambdas with boost::result_of, the most
portable solution is with an adapter, as has been suggested elsewhere in
this thread. Not ideal, but it works.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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