Index: boost/utility/detail/result_of_iterate.hpp =================================================================== --- boost/utility/detail/result_of_iterate.hpp (revision 80596) +++ boost/utility/detail/result_of_iterate.hpp (working copy) @@ -60,7 +60,12 @@ template -struct cpp0x_result_of_impl +struct cpp0x_result_of_impl()( + BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), declval() BOOST_PP_INTERCEPT) + ) + )>::type> { typedef decltype( boost::declval()( Index: boost/utility/result_of.hpp =================================================================== --- boost/utility/result_of.hpp (revision 80596) +++ boost/utility/result_of.hpp (working copy) @@ -56,10 +56,16 @@ #if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) namespace detail { +template +struct result_of_always_void +{ + typedef void type; +}; + BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) template struct tr1_result_of_impl; -template struct cpp0x_result_of_impl; +template struct cpp0x_result_of_impl {}; template struct result_of_void_impl Index: libs/utility/test/result_of_test.cpp =================================================================== --- libs/utility/test/result_of_test.cpp (revision 80596) +++ libs/utility/test/result_of_test.cpp (working copy) @@ -129,6 +129,27 @@ #endif }; +// sfinae_tests are derived from example code from Joel de Guzman, +// which demonstrated the interaction between result_of and SFINAE. +template +typename boost::result_of::type +sfinae_test(F f, Arg const& arg) +{ + return f(arg); +} + +template +typename boost::result_of::type +sfinae_test(F f, Arg& arg) +{ + return f(arg); +} + +int sfinae_test_f(int& i) +{ + return i; +} + struct X {}; int main() @@ -268,5 +289,10 @@ #endif #endif +#if defined(BOOST_RESULT_OF_USE_DECLTYPE) + int i = 123; + sfinae_test(sfinae_test_f, i); +#endif // defined(BOOST_RESULT_OF_USE_DECLTYPE) + return 0; }