diff --git a/include/boost/utility/result_of.hpp b/include/boost/utility/result_of.hpp index c2e6478..cdcac34 100644 --- a/include/boost/utility/result_of.hpp +++ b/include/boost/utility/result_of.hpp @@ -15,6 +15,8 @@ #include #include #include +#include +#include #ifndef BOOST_RESULT_OF_NUM_ARGS # define BOOST_RESULT_OF_NUM_ARGS 10 @@ -55,14 +57,21 @@ struct result_of_impl typedef typename F::result_type type; }; -template -struct result_of_impl - : F::template result -{}; +template +struct is_function_with_no_args : mpl::false_ {}; template -struct result_of_impl - : result_of_void_impl +struct is_function_with_no_args : mpl::true_ {}; + +template +struct result_of_nested_result : F::template result +{}; + +template +struct result_of_impl + : mpl::if_, + result_of_void_impl, + result_of_nested_result >::type {}; } // end namespace detail diff --git a/test/result_of_test.cpp b/test/result_of_test.cpp index ca1cfae..10f3410 100644 --- a/test/result_of_test.cpp +++ b/test/result_of_test.cpp @@ -79,6 +79,7 @@ int main() BOOST_STATIC_ASSERT((is_same::type, int>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); return 0; }