From 2d860e2574952dea7267537151e0eae92ca6a8a4 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 5 Mar 2007 15:25:16 +0000 Subject: [PATCH] Fix result_of's handling of F(void). [SVN r37140] --- include/boost/utility/result_of.hpp | 21 +++++++++++++++------ test/result_of_test.cpp | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) 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; }