Boost logo

Boost :

Subject: Re: [boost] [result_of] Make `cpp0x_result_of_impl` public
From: paul Fultz (pfultz2_at_[hidden])
Date: 2012-03-27 21:38:59


>> Why not implement boost::result_of using decltype only on compilers that
> have N3256 decltype,
>> and give users with compilers that have non-N3256 decltype the option of
> turning on
>> BOOST_RESULT_OF_USE_DECLTYPE?
>
> Because BOOST_RESULT_OF_USE_DECLTYPE is a big hammer, and if someone
> uses that hammer with a non-N3256 compiler, there will be much
> collateral damage. Innocent bystanders. Think of the children.

Why not use both the result_of protocol and decltype? So,
1) detect for the template result
2) check for the type result_type
3) use decltype
Also, on compilers that don't support sfinae for expressions, it could also detect the
callability of the function using the same techniques in Boost.Proto. This way,
result_of<>::type is only valid when the call is valid. Furthermore, the third step could
be emulated on C++03 compilers using Boost.TypeOf and rvalue detection techniques
used in Boost.Foreach.

Thanks,
Paul Fultz II


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk