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
> 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.

Paul Fultz II

Boost list run by bdawes at, gregod at, cpdaniel at, john at