Hi Daniel, Daniel Walker wrote:
At some point, BOOST_RESULT_OF_USE_DECLTYPE may be defined by default, probably when there's enough user interest, so thanks for cc'ing me. The reason it is currently not defined by default is that it is possible that it could introduce breaking changes to some C++03 function objects; e.g. if a function object defines result_type to be some type other than the type of a call expression, then in C++03 result_of would give the user-specified result_type rather than the actual result type, whereas in C++0x result_of always gives the actual result type. For example:
#include
#include struct f { typedef int result_type; double operator()(double); };
int main() { using namespace boost; typedef result_of
::type type; #ifdef BOOST_RESULT_OF_USE_DECLTYPE static_assert(is_same ::value, ""); #else static_assert(is_same ::value, ""); #endif }
Thank you for explaining the problem. And yes, backward compatibility is always problematic. IMO, this use case is not the intended use of boost::result_of, so is it reasonable to deprecate this? And how about adding a "Note" that warns this kind of codes will break in the future to the documentation? Regards, Michel P.S. Eric just completed a patch for BOOST_NO_DECLTYPE_N3276: http://permalink.gmane.org/gmane.comp.lib.boost.devel/219979